function ct1change() {
    var t = $('#ct1');
    if (t.val().indexOf('≮') !== -1) {
        var s = t.val();
        if (t3.val().indexOf('护腕') !== -1) {
            if (s.indexOf('固防') === -1) {
                t[0].options[0].selected = true;
            }
        } else if (t3.val().indexOf('甲') !== -1 || t3.val().indexOf('铠') !== -1) {
            if (s.indexOf('金汤') === -1) {
                t[0].options[0].selected = true;
            }
        } else if (t3.val().indexOf('腰带') !== -1) {
            if (s.indexOf('铁骨') === -1) {
                t[0].options[0].selected = true;
            }
        } else if (t3.val().indexOf('手套') !== -1) {
            if (s.indexOf('厚德') === -1) {
                t[0].options[0].selected = true;
            }
        } else if (t3.val().indexOf('鞋子') !== -1) {
            if (s.indexOf('纳敏') === -1) {
                t[0].options[0].selected = true;
            }
        } else if (t3.val().indexOf('内功戒指') !== -1) {
            if (s.indexOf('益气') === -1) {
                t[0].options[0].selected = true;
            }
        } else if (t3.val().indexOf('内功手镯') !== -1) {
            if (s.indexOf('破空') === -1) {
                t[0].options[0].selected = true;
            }
        } else if (t3.val().indexOf('外功戒指') !== -1) {
            if (s.indexOf('淬力') === -1) {
                t[0].options[0].selected = true;
            }
        } else if (t3.val().indexOf('外功手镯') !== -1) {
            if (s.indexOf('开碑') === -1) {
                t[0].options[0].selected = true;
            }
        } else if (t2.val().indexOf('武器') !== -1) {

        } else {
            t[0].options[0].selected = true;
        }

    }

}

function ct2change() {
    var t = $('#ct2');
    if (t.val().indexOf('≮') !== -1) {
        var s = t.val();
        if (t3.val().indexOf('护腕') !== -1) {
            if (s.indexOf('固防') === -1) {
                t[0].options[0].selected = true;
            }
        } else if (t3.val().indexOf('甲') !== -1 || t3.val().indexOf('铠') !== -1) {
            if (s.indexOf('金汤') === -1) {
                t[0].options[0].selected = true;
            }
        } else if (t3.val().indexOf('腰带') !== -1) {
            if (s.indexOf('铁骨') === -1) {
                t[0].options[0].selected = true;
            }
        } else if (t3.val().indexOf('手套') !== -1) {
            if (s.indexOf('厚德') === -1) {
                t[0].options[0].selected = true;
            }
        } else if (t3.val().indexOf('鞋子') !== -1) {
            if (s.indexOf('纳敏') === -1) {
                t[0].options[0].selected = true;
            }
        } else if (t3.val().indexOf('内功戒指') !== -1) {
            if (s.indexOf('益气') === -1) {
                t[0].options[0].selected = true;
            }
        } else if (t3.val().indexOf('内功手镯') !== -1) {
            if (s.indexOf('破空') === -1) {
                t[0].options[0].selected = true;
            }
        } else if (t3.val().indexOf('外功戒指') !== -1) {
            if (s.indexOf('淬力') === -1) {
                t[0].options[0].selected = true;
            }
        } else if (t3.val().indexOf('外功手镯') !== -1) {
            if (s.indexOf('开碑') === -1) {
                t[0].options[0].selected = true;
            }
        } else if (t2.val().indexOf('武器') !== -1) {

        } else {
            t[0].options[0].selected = true;
        }

    }
}

function ct3change() {
    var t = $('#ct3');
    if (t.val().indexOf('≮') !== -1) {
        var s = t.val();
        if (t3.val().indexOf('护腕') !== -1) {
            if (s.indexOf('固防') === -1) {
                t[0].options[0].selected = true;
            }
        } else if (t3.val().indexOf('甲') !== -1 || t3.val().indexOf('铠') !== -1) {
            if (s.indexOf('金汤') === -1) {
                t[0].options[0].selected = true;
            }
        } else if (t3.val().indexOf('腰带') !== -1) {
            if (s.indexOf('铁骨') === -1) {
                t[0].options[0].selected = true;
            }
        } else if (t3.val().indexOf('手套') !== -1) {
            if (s.indexOf('厚德') === -1) {
                t[0].options[0].selected = true;
            }
        } else if (t3.val().indexOf('鞋子') !== -1) {
            if (s.indexOf('纳敏') === -1) {
                t[0].options[0].selected = true;
            }
        } else if (t3.val().indexOf('内功戒指') !== -1) {
            if (s.indexOf('益气') === -1) {
                t[0].options[0].selected = true;
            }
        } else if (t3.val().indexOf('内功手镯') !== -1) {
            if (s.indexOf('破空') === -1) {
                t[0].options[0].selected = true;
            }
        } else if (t3.val().indexOf('外功戒指') !== -1) {
            if (s.indexOf('淬力') === -1) {
                t[0].options[0].selected = true;
            }
        } else if (t3.val().indexOf('外功手镯') !== -1) {
            if (s.indexOf('开碑') === -1) {
                t[0].options[0].selected = true;
            }
        } else if (t2.val().indexOf('武器') !== -1) {

        } else {
            t[0].options[0].selected = true;
        }

    }
}

function ct4change() {
    var t = $('#ct4');
    if (t.val().indexOf('≮') !== -1) {
        var s = t.val();
        if (t3.val().indexOf('护腕') !== -1) {
            if (s.indexOf('固防') === -1) {
                t[0].options[0].selected = true;
            }
        } else if (t3.val().indexOf('甲') !== -1 || t3.val().indexOf('铠') !== -1) {
            if (s.indexOf('金汤') === -1) {
                t[0].options[0].selected = true;
            }
        } else if (t3.val().indexOf('腰带') !== -1) {
            if (s.indexOf('铁骨') === -1) {
                t[0].options[0].selected = true;
            }
        } else if (t3.val().indexOf('手套') !== -1) {
            if (s.indexOf('厚德') === -1) {
                t[0].options[0].selected = true;
            }
        } else if (t3.val().indexOf('鞋子') !== -1) {
            if (s.indexOf('纳敏') === -1) {
                t[0].options[0].selected = true;
            }
        } else if (t3.val().indexOf('内功戒指') !== -1) {
            if (s.indexOf('益气') === -1) {
                t[0].options[0].selected = true;
            }
        } else if (t3.val().indexOf('内功手镯') !== -1) {
            if (s.indexOf('破空') === -1) {
                t[0].options[0].selected = true;
            }
        } else if (t3.val().indexOf('外功戒指') !== -1) {
            if (s.indexOf('淬力') === -1) {
                t[0].options[0].selected = true;
            }
        } else if (t3.val().indexOf('外功手镯') !== -1) {
            if (s.indexOf('开碑') === -1) {
                t[0].options[0].selected = true;
            }
        } else if (t2.val().indexOf('武器') !== -1) {

        } else {
            t[0].options[0].selected = true;
        }

    }
}

function ct5change() {
    var t = $('#ct5');
    if (t.val().indexOf('≮') !== -1) {
        var s = t.val();
        if (t3.val().indexOf('护腕') !== -1) {
            if (s.indexOf('固防') === -1) {
                t[0].options[0].selected = true;
            }
        } else if (t3.val().indexOf('甲') !== -1 || t3.val().indexOf('铠') !== -1) {
            if (s.indexOf('金汤') === -1) {
                t[0].options[0].selected = true;
            }
        } else if (t3.val().indexOf('腰带') !== -1) {
            if (s.indexOf('铁骨') === -1) {
                t[0].options[0].selected = true;
            }
        } else if (t3.val().indexOf('手套') !== -1) {
            if (s.indexOf('厚德') === -1) {
                t[0].options[0].selected = true;
            }
        } else if (t3.val().indexOf('鞋子') !== -1) {
            if (s.indexOf('纳敏') === -1) {
                t[0].options[0].selected = true;
            }
        } else if (t3.val().indexOf('内功戒指') !== -1) {
            if (s.indexOf('益气') === -1) {
                t[0].options[0].selected = true;
            }
        } else if (t3.val().indexOf('内功手镯') !== -1) {
            if (s.indexOf('破空') === -1) {
                t[0].options[0].selected = true;
            }
        } else if (t3.val().indexOf('外功戒指') !== -1) {
            if (s.indexOf('淬力') === -1) {
                t[0].options[0].selected = true;
            }
        } else if (t3.val().indexOf('外功手镯') !== -1) {
            if (s.indexOf('开碑') === -1) {
                t[0].options[0].selected = true;
            }
        } else if (t2.val().indexOf('武器') !== -1) {

        } else {
            t[0].options[0].selected = true;
        }

    }
}

function ct6change() {
    var t = $('#ct6');
    if (t.val().indexOf('≮') !== -1) {
        var s = t.val();
        if (t3.val().indexOf('护腕') !== -1) {
            if (s.indexOf('固防') === -1) {
                t[0].options[0].selected = true;
            }
        } else if (t3.val().indexOf('甲') !== -1 || t3.val().indexOf('铠') !== -1) {
            if (s.indexOf('金汤') === -1) {
                t[0].options[0].selected = true;
            }
        } else if (t3.val().indexOf('腰带') !== -1) {
            if (s.indexOf('铁骨') === -1) {
                t[0].options[0].selected = true;
            }
        } else if (t3.val().indexOf('手套') !== -1) {
            if (s.indexOf('厚德') === -1) {
                t[0].options[0].selected = true;
            }
        } else if (t3.val().indexOf('鞋子') !== -1) {
            if (s.indexOf('纳敏') === -1) {
                t[0].options[0].selected = true;
            }
        } else if (t3.val().indexOf('内功戒指') !== -1) {
            if (s.indexOf('益气') === -1) {
                t[0].options[0].selected = true;
            }
        } else if (t3.val().indexOf('内功手镯') !== -1) {
            if (s.indexOf('破空') === -1) {
                t[0].options[0].selected = true;
            }
        } else if (t3.val().indexOf('外功戒指') !== -1) {
            if (s.indexOf('淬力') === -1) {
                t[0].options[0].selected = true;
            }
        } else if (t3.val().indexOf('外功手镯') !== -1) {
            if (s.indexOf('开碑') === -1) {
                t[0].options[0].selected = true;
            }
        } else if (t2.val().indexOf('武器') !== -1) {

        } else {
            t[0].options[0].selected = true;
        }

    }
}

function ct7change() {
    var t = $('#ct7');
    if (t.val().indexOf('≮') !== -1) {
        var s = t.val();
        if (t3.val().indexOf('护腕') !== -1) {
            if (s.indexOf('固防') === -1) {
                t[0].options[0].selected = true;
            }
        } else if (t3.val().indexOf('甲') !== -1 || t3.val().indexOf('铠') !== -1) {
            if (s.indexOf('金汤') === -1) {
                t[0].options[0].selected = true;
            }
        } else if (t3.val().indexOf('腰带') !== -1) {
            if (s.indexOf('铁骨') === -1) {
                t[0].options[0].selected = true;
            }
        } else if (t3.val().indexOf('手套') !== -1) {
            if (s.indexOf('厚德') === -1) {
                t[0].options[0].selected = true;
            }
        } else if (t3.val().indexOf('鞋子') !== -1) {
            if (s.indexOf('纳敏') === -1) {
                t[0].options[0].selected = true;
            }
        } else if (t3.val().indexOf('内功戒指') !== -1) {
            if (s.indexOf('益气') === -1) {
                t[0].options[0].selected = true;
            }
        } else if (t3.val().indexOf('内功手镯') !== -1) {
            if (s.indexOf('破空') === -1) {
                t[0].options[0].selected = true;
            }
        } else if (t3.val().indexOf('外功戒指') !== -1) {
            if (s.indexOf('淬力') === -1) {
                t[0].options[0].selected = true;
            }
        } else if (t3.val().indexOf('外功手镯') !== -1) {
            if (s.indexOf('开碑') === -1) {
                t[0].options[0].selected = true;
            }
        } else if (t2.val().indexOf('武器') !== -1) {

        } else {
            t[0].options[0].selected = true;
        }

    }
}

var t1 = $('#lx1');
var t2 = $('#lx2');
var t3 = $('#lx3');
var t4 = $('#lx4');

t1[0].options[0].selected = true;
t2[0].options[0].selected = true;
t3[0].options[0].selected = true;
t4[0].options[0].selected = true;

function lx1change() {
    var ct1 = $('#ct1');
    var ct2 = $('#ct2');
    var ct3 = $('#ct3');
    var ct4 = $('#ct4');
    var ct5 = $('#ct5');
    var ct6 = $('#ct6');
    var ct7 = $('#ct7');
    if (t1.val() === "百炼") {
        ct1.removeAttr('disabled');
        ct2.removeAttr('disabled');
        ct3.removeAttr('disabled');
        ct4.removeAttr('disabled');
        ct5.removeAttr('disabled');
        ct6.removeAttr('disabled');
        ct7.removeAttr('disabled');
    } else if (t1.val() === "紫色") {
        ct1.removeAttr('disabled');
        ct2.removeAttr('disabled');
        ct3.removeAttr('disabled');
        ct4.removeAttr('disabled');
        ct5.removeAttr('disabled');
        ct6.removeAttr('disabled');
        ct7.attr('disabled', 'disabled');
        ct7[0].options[0].selected = true;
    } else if (t1.val() === "红色") {
        ct1.removeAttr('disabled');
        ct2.removeAttr('disabled');
        ct3.removeAttr('disabled');
        ct4.removeAttr('disabled');
        ct5.removeAttr('disabled');
        ct6.attr('disabled', 'disabled');
        ct7.attr('disabled', 'disabled');
        ct6[0].options[0].selected = true;
        ct7[0].options[0].selected = true;
    } else if (t1.val() === "蓝色") {
        ct1.removeAttr('disabled');
        ct2.removeAttr('disabled');
        ct3.removeAttr('disabled');
        ct4.removeAttr('disabled');
        ct5.attr('disabled', 'disabled');
        ct6.attr('disabled', 'disabled');
        ct7.attr('disabled', 'disabled');
        ct5[0].options[0].selected = true;
        ct6[0].options[0].selected = true;
        ct7[0].options[0].selected = true;
    }
    lx3change();
}

function lx2change() {
    if (t2.val() === "防具") {
        var t = '                    <option value="布护腕">布护腕</option>\n' +
            '                    <option value="皮护腕">皮护腕</option>\n' +
            '                    <option value="金属护腕">金属护腕</option>\n' +
            '                    <option value="布头盔">布头盔</option>\n' +
            '                    <option value="皮头盔">皮头盔</option>\n' +
            '                    <option value="金属头盔">金属头盔</option>\n' +
            '                    <option value="布甲">布甲</option>\n' +
            '                    <option value="皮甲">皮甲</option>\n' +
            '                    <option value="金属铠">金属铠</option>\n' +
            '                    <option value="腰带">腰带</option>\n' +
            '                    <option value="手套">手套</option>\n' +
            '                    <option value="鞋子">鞋子</option>';
        t3.empty();
        t3.html(t);
        var keys = Object.keys(fangjucitiao);
        var ct1 = $('#ct1');
        var ct2 = $('#ct2');
        var ct3 = $('#ct3');
        var ct4 = $('#ct4');
        var ct5 = $('#ct5');
        var ct6 = $('#ct6');
        var ct7 = $('#ct7');
        ct1.empty();
        ct2.empty();
        ct3.empty();
        ct4.empty();
        ct5.empty();
        ct6.empty();
        ct7.empty();
        var t = '<option value="无">无</option>';
        ct1.append(t);
        ct2.append(t);
        ct3.append(t);
        ct4.append(t);
        ct5.append(t);
        ct6.append(t);
        ct7.append(t);
        $.each(keys, function (n, v) {
            t = '<option value="' + v + '">' + v + '</option>';
            ct1.append(t);
            ct2.append(t);
            ct3.append(t);
            ct4.append(t);
            ct5.append(t);
            ct6.append(t);
            ct7.append(t);
        });
    } else if (t2.val() === "内功首饰") {
        var t = '                    <option value="内功戒指">内功戒指</option>\n' +
            '                    <option value="内功手镯">内功手镯</option>\n' +
            '                    <option value="内功项链">内功项链</option>' +
            t3.empty();
        t3.html(t);
        var keys = Object.keys(neigongshoushigongjicitiao);
        var ct1 = $('#ct1');
        var ct2 = $('#ct2');
        var ct3 = $('#ct3');
        var ct4 = $('#ct4');
        var ct5 = $('#ct5');
        var ct6 = $('#ct6');
        var ct7 = $('#ct7');
        ct1.empty();
        ct2.empty();
        ct3.empty();
        ct4.empty();
        ct5.empty();
        ct6.empty();
        ct7.empty();
        var t = '<option value="无">无</option>';
        ct1.append(t);
        ct2.append(t);
        ct3.append(t);
        ct4.append(t);
        ct5.append(t);
        ct6.append(t);
        ct7.append(t);
        $.each(keys, function (n, v) {
            t = '<option value="' + v + '">' + v + '</option>';
            ct1.append(t);
            ct2.append(t);
            ct3.append(t);
            ct4.append(t);
            ct5.append(t);
            ct6.append(t);
            ct7.append(t);
        });

    } else if (t2.val() === "外功首饰") {
        var t = '                    <option value="外功戒指">外功戒指</option>\n' +
            '                    <option value="外功手镯">外功手镯</option>\n' +
            '                    <option value="外功项链">外功项链</option>' +
            t3.empty();
        t3.html(t);
        var keys = Object.keys(waigongshoushigongjicitiao);
        var ct1 = $('#ct1');
        var ct2 = $('#ct2');
        var ct3 = $('#ct3');
        var ct4 = $('#ct4');
        var ct5 = $('#ct5');
        var ct6 = $('#ct6');
        var ct7 = $('#ct7');
        ct1.empty();
        ct2.empty();
        ct3.empty();
        ct4.empty();
        ct5.empty();
        ct6.empty();
        ct7.empty();
        var t = '<option value="无">无</option>';
        ct1.append(t);
        ct2.append(t);
        ct3.append(t);
        ct4.append(t);
        ct5.append(t);
        ct6.append(t);
        ct7.append(t);
        $.each(keys, function (n, v) {
            t = '<option value="' + v + '">' + v + '</option>';
            ct1.append(t);
            ct2.append(t);
            ct3.append(t);
            ct4.append(t);
            ct5.append(t);
            ct6.append(t);
            ct7.append(t);
        });
    } else if (t2.val() === "内功武器") {
        var t = '                    <option value="琴">琴</option>\n' +
            '                    <option value="剑">剑</option>\n' +
            '                    <option value="丝带">丝带</option>\n' +
            '                    <option value="灯笼">灯笼</option>' +
            t3.empty();
        t3.html(t);
        var keys = Object.keys(neigongwuqicitiao);
        var ct1 = $('#ct1');
        var ct2 = $('#ct2');
        var ct3 = $('#ct3');
        var ct4 = $('#ct4');
        var ct5 = $('#ct5');
        var ct6 = $('#ct6');
        var ct7 = $('#ct7');
        ct1.empty();
        ct2.empty();
        ct3.empty();
        ct4.empty();
        ct5.empty();
        ct6.empty();
        ct7.empty();
        var t = '<option value="无">无</option>';
        ct1.append(t);
        ct2.append(t);
        ct3.append(t);
        ct4.append(t);
        ct5.append(t);
        ct6.append(t);
        ct7.append(t);
        $.each(keys, function (n, v) {
            t = '<option value="' + v + '">' + v + '</option>';
            ct1.append(t);
            ct2.append(t);
            ct3.append(t);
            ct4.append(t);
            ct5.append(t);
            ct6.append(t);
            ct7.append(t);
        });
    } else if (t2.val() === "外功武器") {
        var t = '                    <option value="长刀">长刀</option>\n' +
            '                    <option value="枪">枪</option>\n' +
            '                    <option value="拳套">拳套</option>' +
            t3.empty();
        t3.html(t);
        var keys = Object.keys(waigongwuqicitiao);
        var ct1 = $('#ct1');
        var ct2 = $('#ct2');
        var ct3 = $('#ct3');
        var ct4 = $('#ct4');
        var ct5 = $('#ct5');
        var ct6 = $('#ct6');
        var ct7 = $('#ct7');
        ct1.empty();
        ct2.empty();
        ct3.empty();
        ct4.empty();
        ct5.empty();
        ct6.empty();
        ct7.empty();
        var t = '<option value="无">无</option>';
        ct1.append(t);
        ct2.append(t);
        ct3.append(t);
        ct4.append(t);
        ct5.append(t);
        ct6.append(t);
        ct7.append(t);
        $.each(keys, function (n, v) {
            t = '<option value="' + v + '">' + v + '</option>';
            ct1.append(t);
            ct2.append(t);
            ct3.append(t);
            ct4.append(t);
            ct5.append(t);
            ct6.append(t);
            ct7.append(t);
        });
    }

    t3[0].options[0].selected = true;
    t4[0].options[0].selected = true;
    lx3change();
}

function lx3change() {
    if (t1.val() === "百炼") {
        if (t3.val() === "布护腕") {
            t4.empty();
            var t = '<option value="百炼·临蔼袖">百炼·临蔼袖</option>';
            t4.append(t);
        } else if (t3.val() === "皮护腕") {
            t4.empty();
            var t = '<option value="百炼·彭潮束">百炼·彭潮束</option>';
            t4.append(t);
        } else if (t3.val() === "金属护腕") {
            t4.empty();
            var t = '<option value="百炼·朱鸟腕">百炼·朱鸟腕</option>';
            t4.append(t);
        } else if (t3.val() === "布头盔") {
            t4.empty();
            var t = '<option value="百炼·薄悴巾">百炼·薄悴巾</option>';
            t4.append(t);
        } else if (t3.val() === "皮头盔") {
            t4.empty();
            var t = '<option value="百炼·太平冠">百炼·太平冠</option>';
            t4.append(t);
        } else if (t3.val() === "金属头盔") {
            t4.empty();
            var t = '<option value="百炼·北庭盔">百炼·北庭盔</option>';
            t4.append(t);
        } else if (t3.val() === "布甲") {
            t4.empty();
            var t = '<option value="百炼·海枯衫">百炼·海枯衫</option>';
            t4.append(t);
        } else if (t3.val() === "皮甲") {
            t4.empty();
            var t = '<option value="百炼·虚南甲">百炼·虚南甲</option>';
            t4.append(t);
        } else if (t3.val() === "金属铠" +
            "") {
            t4.empty();
            var t = '<option value="百炼·振鸿铠">百炼·振鸿铠</option>';
            t4.append(t);
        } else if (t3.val() === "腰带") {
            t4.empty();
            var t = '<option value="百炼·覆舟带">百炼·覆舟带</option>';
            t4.append(t);
        } else if (t3.val() === "手套") {
            t4.empty();
            var t = '<option value="百炼·琼仙手">百炼·琼仙手</option>';
            t4.append(t);
        } else if (t3.val() === "鞋子") {
            t4.empty();
            var t = '<option value="百炼·遗玉履">百炼·遗玉履</option>';
            t4.append(t);
        } else if (t3.val() === "内功戒指") {
            t4.empty();
            var t = '<option value="百炼·晴沙戒">百炼·晴沙戒</option>';
            t4.append(t);
        } else if (t3.val() === "内功手镯") {
            t4.empty();
            var t = '<option value="百炼·庭霜镯">百炼·庭霜镯</option>';
            t4.append(t);
        } else if (t3.val() === "内功项链") {
            t4.empty();
            var t = '<option value="百炼·岁寒坠">百炼·岁寒坠</option>';
            t4.append(t);
        } else if (t3.val() === "外功戒指") {
            t4.empty();
            var t = '<option value="百炼·晚梅戒">百炼·晚梅戒</option>';
            t4.append(t);
        } else if (t3.val() === "外功手镯") {
            t4.empty();
            var t = '<option value="百炼·寒山镯">百炼·寒山镯</option>';
            t4.append(t);
        } else if (t3.val() === "外功项链") {
            t4.empty();
            var t = '<option value="百炼·寇风坠">百炼·寇风坠</option>';
            t4.append(t);
        } else {
            t4.empty();
            var t = '<option value="随机武器">随机武器</option>';
            t4.append(t);
        }

    } else if (t1.val() === "紫色") {
        if (t3.val() === "布护腕") {
            t4.empty();
            var t = '<option value="天苑·松雪袖">天苑·松雪袖</option>';
            t4.append(t);
        } else if (t3.val() === "皮护腕") {
            t4.empty();
            var t = '<option value="天罡·残夜束">天罡·残夜束</option>';
            t4.append(t);
        } else if (t3.val() === "金属护腕") {
            t4.empty();
            var t = '<option value="天柱·阵云臂甲">天柱·阵云臂甲</option>';
            t4.append(t);
        } else if (t3.val() === "布头盔") {
            t4.empty();
            var t = '<option value="天廪·怜幽巾">天廪·怜幽巾</option>';
            t4.append(t);
        } else if (t3.val() === "皮头盔") {
            t4.empty();
            var t = '<option value="天枪·四海八荒冠">天枪·四海八荒冠</option>';
            t4.append(t);
        } else if (t3.val() === "金属头盔") {
            t4.empty();
            var t = '<option value="天狼·蔽川盔">天狼·蔽川盔</option>';
            t4.append(t);
        } else if (t3.val() === "布甲") {
            t4.empty();
            var t = '<option value="天一·翠微衣">天一·翠微衣</option>';
            t4.append(t);
        } else if (t3.val() === "皮甲") {
            t4.empty();
            var t = '<option value="天庾·朝星袍">天庾·朝星袍</option>';
            t4.append(t);
        } else if (t3.val() === "金属铠") {
            t4.empty();
            var t = '<option value="天纪·楚雄甲">天纪·楚雄甲</option>';
            t4.append(t);
        } else if (t3.val() === "腰带") {
            t4.empty();
            var t = '<option value="楚峡·诗酒年华带">楚峡·诗酒年华带</option>';
            t4.append(t);
        } else if (t3.val() === "手套") {
            t4.empty();
            var t = '<option value="泸水·奔浪护手">泸水·奔浪护手</option>';
            t4.append(t);
        } else if (t3.val() === "鞋子") {
            t4.empty();
            var t = '<option value="天山·清歌逐月履">天山·清歌逐月履</option>';
            t4.append(t);
        } else if (t3.val() === "内功戒指") {
            t4.empty();
            var t = '<option value="水云游·云端戒">水云游·云端戒</option>';
            t4.append(t);
        } else if (t3.val() === "内功手镯") {
            t4.empty();
            var t = '<option value="竹枝词·芳夜镯">竹枝词·芳夜镯</option>';
            t4.append(t);
        } else if (t3.val() === "内功项链") {
            t4.empty();
            var t = '<option value="松梢月·玄泽之坠">松梢月·玄泽之坠</option>';
            t4.append(t);
        } else if (t3.val() === "外功戒指") {
            t4.empty();
            var t = '<option value="阳春曲·青帝戒">阳春曲·青帝戒</option>';
            t4.append(t);
        } else if (t3.val() === "外功手镯") {
            t4.empty();
            var t = '<option value="清商怨·九渊镯">清商怨·九渊镯</option>';
            t4.append(t);
        } else if (t3.val() === "外功项链") {
            t4.empty();
            var t = '<option value="临江仙·遗芳之坠">临江仙·遗芳之坠</option>';
            t4.append(t);
        } else {
            t4.empty();
            var t = '<option value="随机武器">随机武器</option>';
            t4.append(t);
        }

    } else if (t1.val() === "红色") {
        if (t3.val() === "布护腕") {
            t4.empty();
            var t = '<option value="松雪袖">松雪袖</option>';
            t4.append(t);
        } else if (t3.val() === "皮护腕") {
            t4.empty();
            var t = '<option value="残夜束">残夜束</option>';
            t4.append(t);
        } else if (t3.val() === "金属护腕") {
            t4.empty();
            var t = '<option value="阵云臂甲">阵云臂甲</option>';
            t4.append(t);
        } else if (t3.val() === "布头盔") {
            t4.empty();
            var t = '<option value="怜幽巾">怜幽巾</option>';
            t4.append(t);
        } else if (t3.val() === "皮头盔") {
            t4.empty();
            var t = '<option value="四海八荒冠">四海八荒冠</option>';
            t4.append(t);
        } else if (t3.val() === "金属头盔") {
            t4.empty();
            var t = '<option value="蔽川盔">蔽川盔</option>';
            t4.append(t);
        } else if (t3.val() === "布甲") {
            t4.empty();
            var t = '<option value="翠微衣">翠微衣</option>';
            t4.append(t);
        } else if (t3.val() === "皮甲") {
            t4.empty();
            var t = '<option value="朝星袍">朝星袍</option>';
            t4.append(t);
        } else if (t3.val() === "金属铠") {
            t4.empty();
            var t = '<option value="楚雄甲">楚雄甲</option>';
            t4.append(t);
        } else if (t3.val() === "腰带") {
            t4.empty();
            var t = '<option value="诗酒年华带">诗酒年华带</option>';
            t4.append(t);
        } else if (t3.val() === "手套") {
            t4.empty();
            var t = '<option value="奔浪护手">奔浪护手</option>';
            t4.append(t);
        } else if (t3.val() === "鞋子") {
            t4.empty();
            var t = '<option value="清歌逐月履">清歌逐月履</option>';
            t4.append(t);
        } else if (t3.val() === "内功戒指") {
            t4.empty();
            var t = '<option value="云端戒">云端戒</option>';
            t4.append(t);
        } else if (t3.val() === "内功手镯") {
            t4.empty();
            var t = '<option value="芳夜镯">芳夜镯</option>';
            t4.append(t);
        } else if (t3.val() === "内功项链") {
            t4.empty();
            var t = '<option value="玄泽之坠">玄泽之坠</option>';
            t4.append(t);
        } else if (t3.val() === "外功戒指") {
            t4.empty();
            var t = '<option value="青帝戒">青帝戒</option>';
            t4.append(t);
        } else if (t3.val() === "外功手镯") {
            t4.empty();
            var t = '<option value="九渊镯">九渊镯</option>';
            t4.append(t);
        } else if (t3.val() === "外功项链") {
            t4.empty();
            var t = '<option value="遗芳之坠">遗芳之坠</option>';
            t4.append(t);
        } else if (t3.val() === "琴") {
            t4.empty();
            var t = '<option value="玲珑琴">玲珑琴</option>';
            t4.append(t);
        } else if (t3.val() === "丝带") {
            t4.empty();
            var t = '<option value="月冷露华缎">月冷露华缎</option>';
            t4.append(t);
        } else if (t3.val() === "剑") {
            t4.empty();
            var t = '<option value="碧水东流剑">碧水东流剑</option>';
            t4.append(t);
        } else if (t3.val() === "灯笼") {
            t4.empty();
            var t = '<option value="暗霜残夜灯">暗霜残夜灯</option>';
            t4.append(t);
        } else if (t3.val() === "长刀") {
            t4.empty();
            var t = '<option value="白玉刀">白玉刀</option>';
            t4.append(t);
        } else if (t3.val() === "枪") {
            t4.empty();
            var t = '<option value="落星波荡枪">落星波荡枪</option>';
            t4.append(t);
        } else if (t3.val() === "拳套") {
            t4.empty();
            var t = '<option value="转蓬长风震">转蓬长风震</option>';
            t4.append(t);
        }

    } else if (t1.val() === "蓝色") {
        if (t3.val() === "布护腕") {
            t4.empty();
            var t = '<option value="瑞霞袖">瑞霞袖</option>';
            t4.append(t);
        } else if (t3.val() === "皮护腕") {
            t4.empty();
            var t = '<option value="横戈裹腕">横戈裹腕</option>';
            t4.append(t);
        } else if (t3.val() === "金属护腕") {
            t4.empty();
            var t = '<option value="落日臂甲">落日臂甲</option>';
            t4.append(t);
        } else if (t3.val() === "布头盔") {
            t4.empty();
            var t = '<option value="瑞霞巾">瑞霞巾</option>';
            t4.append(t);
        } else if (t3.val() === "皮头盔") {
            t4.empty();
            var t = '<option value="横戈冠">横戈冠</option>';
            t4.append(t);
        } else if (t3.val() === "金属头盔") {
            t4.empty();
            var t = '<option value="落日盔">落日盔</option>';
            t4.append(t);
        } else if (t3.val() === "布甲") {
            t4.empty();
            var t = '<option value="瑞霞衫">瑞霞衫</option>';
            t4.append(t);
        } else if (t3.val() === "皮甲") {
            t4.empty();
            var t = '<option value="横戈袍">横戈袍</option>';
            t4.append(t);
        } else if (t3.val() === "金属铠") {
            t4.empty();
            var t = '<option value="落日铠">落日铠</option>';
            t4.append(t);
        } else if (t3.val() === "腰带") {
            t4.empty();
            var t = '<option value="鹰击束带">鹰击束带</option>';
            t4.append(t);
        } else if (t3.val() === "手套") {
            t4.empty();
            var t = '<option value="鹰击护手">鹰击护手</option>';
            t4.append(t);
        } else if (t3.val() === "鞋子") {
            t4.empty();
            var t = '<option value="鹰击云靴">鹰击云靴</option>';
            t4.append(t);
        } else if (t3.val() === "内功戒指") {
            t4.empty();
            var t = '<option value="丹心戒">丹心戒</option>';
            t4.append(t);
        } else if (t3.val() === "内功手镯") {
            t4.empty();
            var t = '<option value="丹心镯">丹心镯</option>';
            t4.append(t);
        } else if (t3.val() === "内功项链") {
            t4.empty();
            var t = '<option value="丹心吊坠">丹心吊坠</option>';
            t4.append(t);
        } else if (t3.val() === "外功戒指") {
            t4.empty();
            var t = '<option value="落梅戒">落梅戒</option>';
            t4.append(t);
        } else if (t3.val() === "外功手镯") {
            t4.empty();
            var t = '<option value="落梅镯">落梅镯</option>';
            t4.append(t);
        } else if (t3.val() === "外功项链") {
            t4.empty();
            var t = '<option value="落梅吊坠">落梅吊坠</option>';
            t4.append(t);
        } else if (t3.val() === "琴") {
            t4.empty();
            var t = '<option value="苏息琴">苏息琴</option>';
            t4.append(t);
        } else if (t3.val() === "丝带") {
            t4.empty();
            var t = '<option value="珠玑缎">珠玑缎</option>';
            t4.append(t);
        } else if (t3.val() === "剑") {
            t4.empty();
            var t = '<option value="留岚剑">留岚剑</option>';
            t4.append(t);
        } else if (t3.val() === "灯笼") {
            t4.empty();
            var t = '<option value="枯兰魂灯">枯兰魂灯</option>';
            t4.append(t);
        } else if (t3.val() === "长刀") {
            t4.empty();
            var t = '<option value="优昙刀">优昙刀</option>';
            t4.append(t);
        } else if (t3.val() === "枪") {
            t4.empty();
            var t = '<option value="驻马枪">驻马枪</option>';
            t4.append(t);
        } else if (t3.val() === "拳套") {
            t4.empty();
            var t = '<option value="壮志凌云震">壮志凌云震</option>';
            t4.append(t);
        }

    }

    if (t3.val() === '琴' || t3.val() === '剑' || t3.val() === '丝带' || t3.val() === '灯笼') {
        var keys = Object.keys(neigongwuqicitiao);
        var ct1 = $('#ct1');
        var ct2 = $('#ct2');
        var ct3 = $('#ct3');
        var ct4 = $('#ct4');
        var ct5 = $('#ct5');
        var ct6 = $('#ct6');
        var ct7 = $('#ct7');
        ct1.empty();
        ct2.empty();
        ct3.empty();
        ct4.empty();
        ct5.empty();
        ct6.empty();
        ct7.empty();
        var t = '<option value="无">无</option>';
        ct1.append(t);
        ct2.append(t);
        ct3.append(t);
        ct4.append(t);
        ct5.append(t);
        ct6.append(t);
        ct7.append(t);
        $.each(keys, function (n, v) {
            t = '<option value="' + v + '">' + v + '</option>';
            ct1.append(t);
            ct2.append(t);
            ct3.append(t);
            ct4.append(t);
            ct5.append(t);
            ct6.append(t);
            ct7.append(t);
        });
    } else if (t3.val() === '长刀' || t3.val() === '枪' || t3.val() === '拳套') {
        var keys = Object.keys(waigongwuqicitiao);
        var ct1 = $('#ct1');
        var ct2 = $('#ct2');
        var ct3 = $('#ct3');
        var ct4 = $('#ct4');
        var ct5 = $('#ct5');
        var ct6 = $('#ct6');
        var ct7 = $('#ct7');
        ct1.empty();
        ct2.empty();
        ct3.empty();
        ct4.empty();
        ct5.empty();
        ct6.empty();
        ct7.empty();
        var t = '<option value="无">无</option>';
        ct1.append(t);
        ct2.append(t);
        ct3.append(t);
        ct4.append(t);
        ct5.append(t);
        ct6.append(t);
        ct7.append(t);
        $.each(keys, function (n, v) {
            t = '<option value="' + v + '">' + v + '</option>';
            ct1.append(t);
            ct2.append(t);
            ct3.append(t);
            ct4.append(t);
            ct5.append(t);
            ct6.append(t);
            ct7.append(t);
        });
    }

    if (t3.val() === "内功项链") {
        var keys = Object.keys(neigongjinengcitiao);
        var ct1 = $('#ct1');
        var ct2 = $('#ct2');
        var ct3 = $('#ct3');
        var ct4 = $('#ct4');
        var ct5 = $('#ct5');
        var ct6 = $('#ct6');
        var ct7 = $('#ct7');
        $.each(keys, function (n, v) {
            t = '<option value="' + v + '">' + v + '</option>';
            ct1.append(t);
            ct2.append(t);
            ct3.append(t);
            ct4.append(t);
            ct5.append(t);
            ct6.append(t);
            ct7.append(t);
        });
    } else if (t3.val() === "外功项链") {
        var keys = Object.keys(waigongjinengcitiao);
        var ct1 = $('#ct1');
        var ct2 = $('#ct2');
        var ct3 = $('#ct3');
        var ct4 = $('#ct4');
        var ct5 = $('#ct5');
        var ct6 = $('#ct6');
        var ct7 = $('#ct7');
        $.each(keys, function (n, v) {
            t = '<option value="' + v + '">' + v + '</option>';
            ct1.append(t);
            ct2.append(t);
            ct3.append(t);
            ct4.append(t);
            ct5.append(t);
            ct6.append(t);
            ct7.append(t);
        });
    } else if (t3.val() === "琴") {
        var keys = Object.keys(shenxiangjinengcitiao);
        var ct1 = $('#ct1');
        var ct2 = $('#ct2');
        var ct3 = $('#ct3');
        var ct4 = $('#ct4');
        var ct5 = $('#ct5');
        var ct6 = $('#ct6');
        var ct7 = $('#ct7');
        $.each(keys, function (n, v) {
            t = '<option value="' + v + '">' + v + '</option>';
            ct1.append(t);
            ct2.append(t);
            ct3.append(t);
            ct4.append(t);
            ct5.append(t);
            ct6.append(t);
            ct7.append(t);
        });
    } else if (t3.val() === "丝带") {
        var keys = Object.keys(suwenjinengcitiao);
        var ct1 = $('#ct1');
        var ct2 = $('#ct2');
        var ct3 = $('#ct3');
        var ct4 = $('#ct4');
        var ct5 = $('#ct5');
        var ct6 = $('#ct6');
        var ct7 = $('#ct7');
        $.each(keys, function (n, v) {
            t = '<option value="' + v + '">' + v + '</option>';
            ct1.append(t);
            ct2.append(t);
            ct3.append(t);
            ct4.append(t);
            ct5.append(t);
            ct6.append(t);
            ct7.append(t);
        });
    } else if (t3.val() === "剑") {
        var keys = Object.keys(longyinjinengcitiao);
        var ct1 = $('#ct1');
        var ct2 = $('#ct2');
        var ct3 = $('#ct3');
        var ct4 = $('#ct4');
        var ct5 = $('#ct5');
        var ct6 = $('#ct6');
        var ct7 = $('#ct7');
        $.each(keys, function (n, v) {
            t = '<option value="' + v + '">' + v + '</option>';
            ct1.append(t);
            ct2.append(t);
            ct3.append(t);
            ct4.append(t);
            ct5.append(t);
            ct6.append(t);
            ct7.append(t);
        });
    } else if (t3.val() === "灯笼") {
        var keys = Object.keys(jiulingjinengcitiao);
        var ct1 = $('#ct1');
        var ct2 = $('#ct2');
        var ct3 = $('#ct3');
        var ct4 = $('#ct4');
        var ct5 = $('#ct5');
        var ct6 = $('#ct6');
        var ct7 = $('#ct7');
        $.each(keys, function (n, v) {
            t = '<option value="' + v + '">' + v + '</option>';
            ct1.append(t);
            ct2.append(t);
            ct3.append(t);
            ct4.append(t);
            ct5.append(t);
            ct6.append(t);
            ct7.append(t);
        });
    } else if (t3.val() === "长刀") {
        var keys = Object.keys(suimengjinengcitiao);
        var ct1 = $('#ct1');
        var ct2 = $('#ct2');
        var ct3 = $('#ct3');
        var ct4 = $('#ct4');
        var ct5 = $('#ct5');
        var ct6 = $('#ct6');
        var ct7 = $('#ct7');
        $.each(keys, function (n, v) {
            t = '<option value="' + v + '">' + v + '</option>';
            ct1.append(t);
            ct2.append(t);
            ct3.append(t);
            ct4.append(t);
            ct5.append(t);
            ct6.append(t);
            ct7.append(t);
        });
    } else if (t3.val() === "枪") {
        var keys = Object.keys(xuehejinengcitiao);
        var ct1 = $('#ct1');
        var ct2 = $('#ct2');
        var ct3 = $('#ct3');
        var ct4 = $('#ct4');
        var ct5 = $('#ct5');
        var ct6 = $('#ct6');
        var ct7 = $('#ct7');
        $.each(keys, function (n, v) {
            t = '<option value="' + v + '">' + v + '</option>';
            ct1.append(t);
            ct2.append(t);
            ct3.append(t);
            ct4.append(t);
            ct5.append(t);
            ct6.append(t);
            ct7.append(t);
        });
    } else if (t3.val() === "拳套") {
        var keys = Object.keys(tieyijinengcitiao);
        var ct1 = $('#ct1');
        var ct2 = $('#ct2');
        var ct3 = $('#ct3');
        var ct4 = $('#ct4');
        var ct5 = $('#ct5');
        var ct6 = $('#ct6');
        var ct7 = $('#ct7');
        $.each(keys, function (n, v) {
            t = '<option value="' + v + '">' + v + '</option>';
            ct1.append(t);
            ct2.append(t);
            ct3.append(t);
            ct4.append(t);
            ct5.append(t);
            ct6.append(t);
            ct7.append(t);
        });
    }

    ct1change();
    ct2change();
    ct3change();
    ct4change();
    ct5change();
    ct6change();
    ct7change();

}

function lx4change() {

}

/*var keys = Object.keys(fangjucitiao);
var ct1 = $('#ct1');
var ct2 = $('#ct2');
var ct3 = $('#ct3');
var ct4 = $('#ct4');
var ct5 = $('#ct5');
var ct6 = $('#ct6');
var ct7 = $('#ct7');
ct1.empty();
ct2.empty();
ct3.empty();
ct4.empty();
ct5.empty();
ct6.empty();
ct7.empty();
$.each(keys, function (n, v) {
    var t = '<option value="' + v + '">' + v + '</option>';
    ct1.append(t);
    ct2.append(t);
    ct3.append(t);
    ct4.append(t);
    ct5.append(t);
    ct6.append(t);
    ct7.append(t);
});*/

$('#okspawn').click(function () {
    var pinzhi = t1.val();
    var leixing1 = t2.val();
    var leixing2 = t3.val();
    var name = t4.val();
    if (spawnindex === 1) {

        var a, b;
        var aa = "";
        a = pinzhi;
        b = leixing1;

        var n = 0;
        var g = "未知";

        var c = leixing2;
        var gpoint = [];

        var t_xuetong1 = "";
        xuetong1leixing1 = b;
        xuetong1leixing2 = c;
        xuetong1 = [];
        //n = 1;
        var count = 0;
        xuetong1extra = "";
        for (var i = 1; i < 7 + 1; i++) {
            var t = $('#ct' + i);
            if (!t.attr('disabled')) {
                if (t.val() !== "无") {
                    count++;
                    if (t.val() === "神秘词条") {
                        count++;
                        var txu = [];
                        var meiyong = 0;
                        if (b === "防具") {
                            create_fangju(4, txu, meiyong, a);
                        } else if (b === "内功武器") {
                            create_neigongwuqi(4, txu, meiyong, a, c);
                        } else if (b === "外功武器") {
                            create_waigongwuqi(4, txu, meiyong, a, c);
                        } else if (b === "内功首饰") {
                            create_neigongshoushi(4, txu, meiyong, a, c);
                        } else if (b === "外功首饰") {
                            create_waigongshoushi(4, txu, meiyong, a, c);
                        }
                        xuetong1.push(txu[0]);
                    } else {
                        xuetong1.push(t.val());
                    }
                }


            }
        }

        if (pinzhi === "百炼") {
            if (count < 2) {
                s_alert('提示', '百炼装备必须需要2个词条！');
                return;
            }
        } else if (pinzhi === "紫色") {
            if (count < 2) {
                s_alert('提示', '紫色装备必须需要2个词条！');
                return;
            }
        }

        var allpoint = 0;
        $.each(xuetong1, function (n, v) {
            var value = [];
            var displayvalue = "";

            if (b === "防具") {
                value = fangjucitiaoshuzhi[v];
                if (value[0] < 1) {
                    var tv1 = value[0] * 1000;
                    var tv2 = value[1] * 1000;
                    var finalvalue = random(tv1, tv2);
                    var tpoint = jisuanfangjupingfen(xuetong1leixing1, v, finalvalue, pinzhi);
                    allpoint += tpoint;
                    finalvalue /= 1000;
                    displayvalue = (finalvalue * 100).toFixed(1) + '%';
                } else {
                    var finalvalue = random(value[0], value[1]);
                    var tpoint = jisuanfangjupingfen(xuetong1leixing1, v, finalvalue, pinzhi);
                    allpoint += tpoint;
                    displayvalue = parseInt(finalvalue);
                }
                t_xuetong1 += v + "：+" + displayvalue + '<br/>';
            } else {
                if (v.indexOf("技能") !== -1 || v.indexOf("心法") !== -1) {
                    if (c.indexOf('项链') !== -1) {
                        value = shoushijinengcitiaochuzhi[v];
                    } else {
                        value = wuqijinengcitiaochuzhi[v];
                    }
                } else {
                    value = gongjicitiaoshuzhi[v];
                }

                if (value[0] < 1) {
                    var tv1 = value[0] * 1000;
                    var tv2 = value[1] * 1000;
                    var finalvalue = random(tv1, tv2);
                    var tpoint = jisuanfangjupingfen(xuetong1leixing2, v, finalvalue, pinzhi);
                    allpoint += tpoint;
                    finalvalue /= 1000;
                    if (v.indexOf("最小基础") !== -1 || v.indexOf("最大基础") !== -1) {
                        displayvalue = (finalvalue * 100).toFixed(0) + '.0%';
                    } else {
                        displayvalue = (finalvalue * 100).toFixed(1) + '%';
                    }
                } else {
                    var finalvalue = random(value[0], value[1]);
                    var tpoint = jisuanfangjupingfen(xuetong1leixing2, v, finalvalue, pinzhi);
                    allpoint += tpoint;
                    displayvalue = parseInt(finalvalue);
                }

                t_xuetong1 += v + "：+" + displayvalue + '<br/>';
            }

        });


        xuetong1pinzhi = a;
        xuetong1pingfen = allpoint;
        if (b === "防具") {
            if (c === "腰带") {
                g = "全职业";
                //xuetong1pingfen *= 1.25;
            } else if (c === "手套") {
                g = "全职业";
                //xuetong1pingfen *= 1.8;
            } else if (c === "鞋子") {
                g = "全职业";
                //xuetong1pingfen *= 2.1;
            } else if (c === "皮护腕") {
                g = "龙吟 碎梦";
                //xuetong1pingfen *= 1.4;
            } else if (c === "金属护腕") {
                g = "铁衣 血河";
                //xuetong1pingfen *= 1.4;
            } else if (c === "布护腕") {
                g = "神相 素问 九灵";
                //xuetong1pingfen *= 1.4;
            } else if (c === "皮头盔") {
                g = "龙吟 碎梦";
                //xuetong1pingfen *= 1.3;
            } else if (c === "金属头盔") {
                g = "铁衣 血河";
                //xuetong1pingfen *= 1.3;
            } else if (c === "布头盔") {
                g = "神相 素问 九灵";
                //xuetong1pingfen *= 1.3;
            } else if (c === "皮甲") {
                g = "龙吟 碎梦";
                //xuetong1pingfen *= 1.6;
            } else if (c === "金属铠") {
                g = "铁衣 血河";
                //xuetong1pingfen *= 1.6;
            } else if (c === "布甲") {
                g = "神相 素问 九灵";
                //xuetong1pingfen *= 1.6;
            }
        } else if (xuetong1leixing1.indexOf("武器") !== -1) {
            if (a === "紫色" || a === "百炼") {
                var wuqibujian = {};
                var extratext = create_wuqibujian(c, a, wuqibujian);
                if (wuqibujian.bujian3name.indexOf('蒲元') !== -1) {
                    if (wuqibujian.bujian1name.indexOf('蒲元') !== -1 && wuqibujian.bujian2name.indexOf('蒲元') !== -1) {
                        name = "蒲元·淬厉刀";
                    } else {
                        name = "淬厉刀";
                    }
                    g = "碎梦";
                } else if (wuqibujian.bujian3name.indexOf('豫让') !== -1) {
                    if (wuqibujian.bujian1name.indexOf('豫让') !== -1 && wuqibujian.bujian2name.indexOf('豫让') !== -1) {
                        name = "豫让·金错刀";
                    } else {
                        name = "金错刀";
                    }
                    g = "碎梦";
                } else if (wuqibujian.bujian3name.indexOf('曹彬') !== -1) {
                    if (wuqibujian.bujian1name.indexOf('曹彬') !== -1 && wuqibujian.bujian2name.indexOf('曹彬') !== -1) {
                        name = "曹彬·乱星刀";
                    } else {
                        name = "乱星刀";
                    }
                    g = "碎梦";
                }

                if (wuqibujian.bujian3name.indexOf('高仙芝') !== -1) {
                    if (wuqibujian.bujian1name.indexOf('高仙芝') !== -1 && wuqibujian.bujian2name.indexOf('高仙芝') !== -1) {
                        name = "高仙芝·林暗草惊震";
                    } else {
                        name = "林暗草惊震";
                    }
                    g = "铁衣";
                } else if (wuqibujian.bujian3name.indexOf('马援') !== -1) {
                    if (wuqibujian.bujian1name.indexOf('马援') !== -1 && wuqibujian.bujian2name.indexOf('马援') !== -1) {
                        name = "马援·燕歌塞鸿震";
                    } else {
                        name = "燕歌塞鸿震";
                    }
                    g = "铁衣";
                } else if (wuqibujian.bujian3name.indexOf('张飞') !== -1) {
                    if (wuqibujian.bujian1name.indexOf('张飞') !== -1 && wuqibujian.bujian2name.indexOf('张飞') !== -1) {
                        name = "张飞·虎贲镇岳击";
                    } else {
                        name = "虎贲镇岳击";
                    }
                    g = "铁衣";
                }

                if (wuqibujian.bujian3name.indexOf('王彦章') !== -1) {
                    if (wuqibujian.bujian1name.indexOf('王彦章') !== -1 && wuqibujian.bujian2name.indexOf('王彦章') !== -1) {
                        name = "王彦章·风云铁枪";
                    } else {
                        name = "风云铁枪";
                    }
                    g = "血河";
                } else if (wuqibujian.bujian3name.indexOf('姜维') !== -1) {
                    if (wuqibujian.bujian1name.indexOf('姜维') !== -1 && wuqibujian.bujian2name.indexOf('姜维') !== -1) {
                        name = "姜维·绿沉枪";
                    } else {
                        name = "绿沉枪";
                    }
                    g = "血河";
                } else if (wuqibujian.bujian3name.indexOf('穆桂英') !== -1) {
                    if (wuqibujian.bujian1name.indexOf('穆桂英') !== -1 && wuqibujian.bujian2name.indexOf('穆桂英') !== -1) {
                        name = "穆桂英·暴雨梨花枪";
                    } else {
                        name = "暴雨梨花枪";
                    }
                    g = "血河";
                }

                if (wuqibujian.bujian3name.indexOf('雷海清') !== -1) {
                    if (wuqibujian.bujian1name.indexOf('雷海清') !== -1 && wuqibujian.bujian2name.indexOf('雷海清') !== -1) {
                        name = "雷海清·引梅琴";
                    } else {
                        name = "引梅琴";
                    }
                    g = "神相";
                } else if (wuqibujian.bujian3name.indexOf('张文收') !== -1) {
                    if (wuqibujian.bujian1name.indexOf('张文收') !== -1 && wuqibujian.bujian2name.indexOf('张文收') !== -1) {
                        name = "张文收·景云河清琴";
                    } else {
                        name = "景云河清琴";
                    }
                    g = "神相";
                } else if (wuqibujian.bujian3name.indexOf('蔡邕') !== -1) {
                    if (wuqibujian.bujian1name.indexOf('蔡邕') !== -1 && wuqibujian.bujian2name.indexOf('蔡邕') !== -1) {
                        name = "蔡邕·焦尾琴";
                    } else {
                        name = "焦尾琴";
                    }
                    g = "神相";
                }

                if (wuqibujian.bujian3name.indexOf('徐之才') !== -1) {
                    if (wuqibujian.bujian1name.indexOf('徐之才') !== -1 && wuqibujian.bujian2name.indexOf('徐之才') !== -1) {
                        name = "徐之才·幻生逐月纱";
                    } else {
                        name = "幻生逐月纱";
                    }
                    g = "素问";
                } else if (wuqibujian.bujian3name.indexOf('公乘阳庆') !== -1) {
                    if (wuqibujian.bujian1name.indexOf('公乘阳庆') !== -1 && wuqibujian.bujian2name.indexOf('公乘阳庆') !== -1) {
                        name = "公乘阳庆·璧月珠星纱";
                    } else {
                        name = "璧月珠星纱";
                    }
                    g = "素问";
                } else if (wuqibujian.bujian3name.indexOf('刘涓子') !== -1) {
                    if (wuqibujian.bujian1name.indexOf('刘涓子') !== -1 && wuqibujian.bujian2name.indexOf('刘涓子') !== -1) {
                        name = "刘涓子·蔽月回雪缎";
                    } else {
                        name = "蔽月回雪缎";
                    }
                    g = "素问";
                }

                if (wuqibujian.bujian3name.indexOf('嬴驷') !== -1) {
                    if (wuqibujian.bujian1name.indexOf('嬴驷') !== -1 && wuqibujian.bujian2name.indexOf('嬴驷') !== -1) {
                        name = "嬴驷·刃碎春冰剑";
                    } else {
                        name = "刃碎春冰剑";
                    }
                    g = "龙吟";
                } else if (wuqibujian.bujian3name.indexOf('兰陵老人') !== -1) {
                    if (wuqibujian.bujian1name.indexOf('兰陵老人') !== -1 && wuqibujian.bujian2name.indexOf('兰陵老人') !== -1) {
                        name = "兰陵老人·十载风波剑";
                    } else {
                        name = "十载风波剑";
                    }
                    g = "龙吟";
                } else if (wuqibujian.bujian3name.indexOf('钩弋夫人') !== -1) {
                    if (wuqibujian.bujian1name.indexOf('钩弋夫人') !== -1 && wuqibujian.bujian2name.indexOf('钩弋夫人') !== -1) {
                        name = "钩弋夫人·飞光凌烟剑";
                    } else {
                        name = "飞光凌烟剑";
                    }
                    g = "龙吟";
                }

                if (wuqibujian.bujian3name.indexOf('麻姑') !== -1) {
                    if (wuqibujian.bujian1name.indexOf('麻姑') !== -1 && wuqibujian.bujian2name.indexOf('麻姑') !== -1) {
                        name = "麻姑·虚寂冲应灯";
                    } else {
                        name = "虚寂冲应灯";
                    }
                    g = "九灵";
                } else if (wuqibujian.bujian3name.indexOf('葛洪') !== -1) {
                    if (wuqibujian.bujian1name.indexOf('葛洪') !== -1 && wuqibujian.bujian2name.indexOf('葛洪') !== -1) {
                        name = "葛洪·玉川抱朴灯";
                    } else {
                        name = "玉川抱朴灯";
                    }
                    g = "九灵";
                } else if (wuqibujian.bujian3name.indexOf('葛玄') !== -1) {
                    if (wuqibujian.bujian1name.indexOf('葛玄') !== -1 && wuqibujian.bujian2name.indexOf('葛玄') !== -1) {
                        name = "葛玄·楚吟幽素灯";
                    } else {
                        name = "楚吟幽素灯";
                    }
                    g = "九灵";
                }


                xuetong1extra = extratext;
            } else if (a === "红色") {
                if (leixing2 === "长刀") {
                    g = "碎梦";
                } else if (leixing2 === "拳套") {
                    g = "铁衣";
                } else if (leixing2 === "枪") {
                    g = "血河";
                } else if (leixing2 === "琴") {
                    g = "神相";
                } else if (leixing2 === "剑") {
                    g = "龙吟";
                } else if (leixing2 === "丝带") {
                    g = "素问";
                } else if (leixing2 === "灯笼") {
                    g = "九灵";
                }
            }

        } else {
            if (leixing2.indexOf('外功') !== -1) {
                g = "外功职业";
            } else {
                g = "内功职业";
            }

        }
        if (count === 7) {
            name += '·无极';
        }
        var tpoint = [];
        var adds = 1;
        $.each(xuetong1, function (n, v) {
            if (v.indexOf('逆水') !== -1) {
                adds += 0.3;
            }

            if (v.indexOf('凭风') !== -1) {
                adds += 0.15;
            }

        });
        xuetong1jichu = create_jichushuxing(b, c, a, xuetong1extra, tpoint, adds);
        xuetong1jichupingfen = tpoint[0];
        xuetong1pingfen += tpoint[0];
        xuetong1name = name;
        xuetong1shiyong = g;
        xuetong1citiao = t_xuetong1;
        xuetong1chuli();
        citiaohuchichuli(true, 1);
    } else {

        var a, b;
        var aa = "";
        a = pinzhi;
        b = leixing1;

        var n = 0;
        var g = "未知";

        var c = leixing2;
        var gpoint = [];

        var t_xuetong2 = "";
        xuetong2leixing1 = b;
        xuetong2leixing2 = c;
        xuetong2 = [];
        //n = 1;
        var count = 0;
        xuetong2extra = "";
        for (var i = 1; i < 7 + 1; i++) {
            var t = $('#ct' + i);
            if (!t.attr('disabled')) {
                if (t.val() !== "无") {
                    count++;
                    if (t.val() === "神秘词条") {
                        count++;
                        var txu = [];
                        var meiyong = 0;
                        if (b === "防具") {
                            create_fangju(4, txu, meiyong, a);
                        } else if (b === "内功武器") {
                            create_neigongwuqi(4, txu, meiyong, a, c);
                        } else if (b === "外功武器") {
                            create_waigongwuqi(4, txu, meiyong, a, c);
                        } else if (b === "内功首饰") {
                            create_neigongshoushi(4, txu, meiyong, a, c);
                        } else if (b === "外功首饰") {
                            create_waigongshoushi(4, txu, meiyong, a, c);
                        }
                        xuetong2.push(txu[0]);
                    } else {
                        xuetong2.push(t.val());
                    }
                }


            }
        }

        if (pinzhi === "百炼") {
            if (count < 2) {
                s_alert('提示', '百炼装备必须需要2个词条！');
                return;
            }
        } else if (pinzhi === "紫色") {
            if (count < 2) {
                s_alert('提示', '紫色装备必须需要2个词条！');
                return;
            }
        }

        var allpoint = 0;
        $.each(xuetong2, function (n, v) {
            var value = [];
            var displayvalue = "";

            if (b === "防具") {
                value = fangjucitiaoshuzhi[v];
                if (value[0] < 1) {
                    var tv1 = value[0] * 1000;
                    var tv2 = value[1] * 1000;
                    var finalvalue = random(tv1, tv2);
                    var tpoint = jisuanfangjupingfen(xuetong2leixing1, v, finalvalue, pinzhi);
                    allpoint += tpoint;
                    finalvalue /= 1000;
                    displayvalue = (finalvalue * 100).toFixed(1) + '%';
                } else {
                    var finalvalue = random(value[0], value[1]);
                    var tpoint = jisuanfangjupingfen(xuetong2leixing1, v, finalvalue, pinzhi);
                    allpoint += tpoint;
                    displayvalue = parseInt(finalvalue);
                }
                t_xuetong2 += v + "：+" + displayvalue + '<br/>';
            } else {
                if (v.indexOf("技能") !== -1 || v.indexOf("心法") !== -1) {
                    if (c.indexOf('项链') !== -1) {
                        value = shoushijinengcitiaochuzhi[v];
                    } else {
                        value = wuqijinengcitiaochuzhi[v];
                    }
                } else {
                    value = gongjicitiaoshuzhi[v];
                }

                if (value[0] < 1) {
                    var tv1 = value[0] * 1000;
                    var tv2 = value[1] * 1000;
                    var finalvalue = random(tv1, tv2);
                    var tpoint = jisuanfangjupingfen(xuetong2leixing2, v, finalvalue, pinzhi);
                    allpoint += tpoint;
                    finalvalue /= 1000;
                    if (v.indexOf("最小基础") !== -1 || v.indexOf("最大基础") !== -1) {
                        displayvalue = (finalvalue * 100).toFixed(0) + '.0%';
                    } else {
                        displayvalue = (finalvalue * 100).toFixed(1) + '%';
                    }
                } else {
                    var finalvalue = random(value[0], value[1]);
                    var tpoint = jisuanfangjupingfen(xuetong2leixing2, v, finalvalue, pinzhi);
                    allpoint += tpoint;
                    displayvalue = parseInt(finalvalue);
                }

                t_xuetong2 += v + "：+" + displayvalue + '<br/>';
            }

        });


        xuetong2pinzhi = a;
        xuetong2pingfen = allpoint;
        if (b === "防具") {
            if (c === "腰带") {
                g = "全职业";
                //xuetong2pingfen *= 1.25;
            } else if (c === "手套") {
                g = "全职业";
                //xuetong2pingfen *= 1.8;
            } else if (c === "鞋子") {
                g = "全职业";
                //xuetong2pingfen *= 2.1;
            } else if (c === "皮护腕") {
                g = "龙吟 碎梦";
                //xuetong2pingfen *= 1.4;
            } else if (c === "金属护腕") {
                g = "铁衣 血河";
                //xuetong2pingfen *= 1.4;
            } else if (c === "布护腕") {
                g = "神相 素问 九灵";
                //xuetong2pingfen *= 1.4;
            } else if (c === "皮头盔") {
                g = "龙吟 碎梦";
                //xuetong2pingfen *= 1.3;
            } else if (c === "金属头盔") {
                g = "铁衣 血河";
                //xuetong2pingfen *= 1.3;
            } else if (c === "布头盔") {
                g = "神相 素问 九灵";
                //xuetong2pingfen *= 1.3;
            } else if (c === "皮甲") {
                g = "龙吟 碎梦";
                //xuetong2pingfen *= 1.6;
            } else if (c === "金属铠") {
                g = "铁衣 血河";
                //xuetong2pingfen *= 1.6;
            } else if (c === "布甲") {
                g = "神相 素问 九灵";
                //xuetong2pingfen *= 1.6;
            }
        } else if (xuetong2leixing1.indexOf("武器") !== -1) {
            if (a === "紫色" || a === "百炼") {
                var wuqibujian = {};
                var extratext = create_wuqibujian(c, a, wuqibujian);
                if (wuqibujian.bujian3name.indexOf('蒲元') !== -1) {
                    if (wuqibujian.bujian1name.indexOf('蒲元') !== -1 && wuqibujian.bujian2name.indexOf('蒲元') !== -1) {
                        name = "蒲元·淬厉刀";
                    } else {
                        name = "淬厉刀";
                    }
                    g = "碎梦";
                } else if (wuqibujian.bujian3name.indexOf('豫让') !== -1) {
                    if (wuqibujian.bujian1name.indexOf('豫让') !== -1 && wuqibujian.bujian2name.indexOf('豫让') !== -1) {
                        name = "豫让·金错刀";
                    } else {
                        name = "金错刀";
                    }
                    g = "碎梦";
                } else if (wuqibujian.bujian3name.indexOf('曹彬') !== -1) {
                    if (wuqibujian.bujian1name.indexOf('曹彬') !== -1 && wuqibujian.bujian2name.indexOf('曹彬') !== -1) {
                        name = "曹彬·乱星刀";
                    } else {
                        name = "乱星刀";
                    }
                    g = "碎梦";
                }

                if (wuqibujian.bujian3name.indexOf('高仙芝') !== -1) {
                    if (wuqibujian.bujian1name.indexOf('高仙芝') !== -1 && wuqibujian.bujian2name.indexOf('高仙芝') !== -1) {
                        name = "高仙芝·林暗草惊震";
                    } else {
                        name = "林暗草惊震";
                    }
                    g = "铁衣";
                } else if (wuqibujian.bujian3name.indexOf('马援') !== -1) {
                    if (wuqibujian.bujian1name.indexOf('马援') !== -1 && wuqibujian.bujian2name.indexOf('马援') !== -1) {
                        name = "马援·燕歌塞鸿震";
                    } else {
                        name = "燕歌塞鸿震";
                    }
                    g = "铁衣";
                } else if (wuqibujian.bujian3name.indexOf('张飞') !== -1) {
                    if (wuqibujian.bujian1name.indexOf('张飞') !== -1 && wuqibujian.bujian2name.indexOf('张飞') !== -1) {
                        name = "张飞·虎贲镇岳击";
                    } else {
                        name = "虎贲镇岳击";
                    }
                    g = "铁衣";
                }

                if (wuqibujian.bujian3name.indexOf('王彦章') !== -1) {
                    if (wuqibujian.bujian1name.indexOf('王彦章') !== -1 && wuqibujian.bujian2name.indexOf('王彦章') !== -1) {
                        name = "王彦章·风云铁枪";
                    } else {
                        name = "风云铁枪";
                    }
                    g = "血河";
                } else if (wuqibujian.bujian3name.indexOf('姜维') !== -1) {
                    if (wuqibujian.bujian1name.indexOf('姜维') !== -1 && wuqibujian.bujian2name.indexOf('姜维') !== -1) {
                        name = "姜维·绿沉枪";
                    } else {
                        name = "绿沉枪";
                    }
                    g = "血河";
                } else if (wuqibujian.bujian3name.indexOf('穆桂英') !== -1) {
                    if (wuqibujian.bujian1name.indexOf('穆桂英') !== -1 && wuqibujian.bujian2name.indexOf('穆桂英') !== -1) {
                        name = "穆桂英·暴雨梨花枪";
                    } else {
                        name = "暴雨梨花枪";
                    }
                    g = "血河";
                }

                if (wuqibujian.bujian3name.indexOf('雷海清') !== -1) {
                    if (wuqibujian.bujian1name.indexOf('雷海清') !== -1 && wuqibujian.bujian2name.indexOf('雷海清') !== -1) {
                        name = "雷海清·引梅琴";
                    } else {
                        name = "引梅琴";
                    }
                    g = "神相";
                } else if (wuqibujian.bujian3name.indexOf('张文收') !== -1) {
                    if (wuqibujian.bujian1name.indexOf('张文收') !== -1 && wuqibujian.bujian2name.indexOf('张文收') !== -1) {
                        name = "张文收·景云河清琴";
                    } else {
                        name = "景云河清琴";
                    }
                    g = "神相";
                } else if (wuqibujian.bujian3name.indexOf('蔡邕') !== -1) {
                    if (wuqibujian.bujian1name.indexOf('蔡邕') !== -1 && wuqibujian.bujian2name.indexOf('蔡邕') !== -1) {
                        name = "蔡邕·焦尾琴";
                    } else {
                        name = "焦尾琴";
                    }
                    g = "神相";
                }

                if (wuqibujian.bujian3name.indexOf('徐之才') !== -1) {
                    if (wuqibujian.bujian1name.indexOf('徐之才') !== -1 && wuqibujian.bujian2name.indexOf('徐之才') !== -1) {
                        name = "徐之才·幻生逐月纱";
                    } else {
                        name = "幻生逐月纱";
                    }
                    g = "素问";
                } else if (wuqibujian.bujian3name.indexOf('公乘阳庆') !== -1) {
                    if (wuqibujian.bujian1name.indexOf('公乘阳庆') !== -1 && wuqibujian.bujian2name.indexOf('公乘阳庆') !== -1) {
                        name = "公乘阳庆·璧月珠星纱";
                    } else {
                        name = "璧月珠星纱";
                    }
                    g = "素问";
                } else if (wuqibujian.bujian3name.indexOf('刘涓子') !== -1) {
                    if (wuqibujian.bujian1name.indexOf('刘涓子') !== -1 && wuqibujian.bujian2name.indexOf('刘涓子') !== -1) {
                        name = "刘涓子·蔽月回雪缎";
                    } else {
                        name = "蔽月回雪缎";
                    }
                    g = "素问";
                }

                if (wuqibujian.bujian3name.indexOf('嬴驷') !== -1) {
                    if (wuqibujian.bujian1name.indexOf('嬴驷') !== -1 && wuqibujian.bujian2name.indexOf('嬴驷') !== -1) {
                        name = "嬴驷·刃碎春冰剑";
                    } else {
                        name = "刃碎春冰剑";
                    }
                    g = "龙吟";
                } else if (wuqibujian.bujian3name.indexOf('兰陵老人') !== -1) {
                    if (wuqibujian.bujian1name.indexOf('兰陵老人') !== -1 && wuqibujian.bujian2name.indexOf('兰陵老人') !== -1) {
                        name = "兰陵老人·十载风波剑";
                    } else {
                        name = "十载风波剑";
                    }
                    g = "龙吟";
                } else if (wuqibujian.bujian3name.indexOf('钩弋夫人') !== -1) {
                    if (wuqibujian.bujian1name.indexOf('钩弋夫人') !== -1 && wuqibujian.bujian2name.indexOf('钩弋夫人') !== -1) {
                        name = "钩弋夫人·飞光凌烟剑";
                    } else {
                        name = "飞光凌烟剑";
                    }
                    g = "龙吟";
                }

                if (wuqibujian.bujian3name.indexOf('麻姑') !== -1) {
                    if (wuqibujian.bujian1name.indexOf('麻姑') !== -1 && wuqibujian.bujian2name.indexOf('麻姑') !== -1) {
                        name = "麻姑·虚寂冲应灯";
                    } else {
                        name = "虚寂冲应灯";
                    }
                    g = "九灵";
                } else if (wuqibujian.bujian3name.indexOf('葛洪') !== -1) {
                    if (wuqibujian.bujian1name.indexOf('葛洪') !== -1 && wuqibujian.bujian2name.indexOf('葛洪') !== -1) {
                        name = "葛洪·玉川抱朴灯";
                    } else {
                        name = "玉川抱朴灯";
                    }
                    g = "九灵";
                } else if (wuqibujian.bujian3name.indexOf('葛玄') !== -1) {
                    if (wuqibujian.bujian1name.indexOf('葛玄') !== -1 && wuqibujian.bujian2name.indexOf('葛玄') !== -1) {
                        name = "葛玄·楚吟幽素灯";
                    } else {
                        name = "楚吟幽素灯";
                    }
                    g = "九灵";
                }


                xuetong2extra = extratext;
            } else if (a === "红色") {
                if (leixing2 === "长刀") {
                    g = "碎梦";
                } else if (leixing2 === "拳套") {
                    g = "铁衣";
                } else if (leixing2 === "枪") {
                    g = "血河";
                } else if (leixing2 === "琴") {
                    g = "神相";
                } else if (leixing2 === "剑") {
                    g = "龙吟";
                } else if (leixing2 === "丝带") {
                    g = "素问";
                } else if (leixing2 === "灯笼") {
                    g = "九灵";
                }
            }

        } else {
            if (leixing2.indexOf('外功') !== -1) {
                g = "外功职业";
            } else {
                g = "内功职业";
            }

        }
        if (count === 7) {
            name += '·无极';
        }
        var tpoint = [];
        var adds = 1;
        $.each(xuetong2, function (n, v) {
            if (v.indexOf('逆水') !== -1) {
                adds += 0.3;
            }

            if (v.indexOf('凭风') !== -1) {
                adds += 0.15;
            }

        });
        xuetong2jichu = create_jichushuxing(b, c, a, xuetong2extra, tpoint, adds);
        xuetong2jichupingfen = tpoint[0];
        xuetong2pingfen += tpoint[0];
        xuetong2name = name;
        xuetong2shiyong = g;
        xuetong2citiao = t_xuetong2;
        xuetong2chuli();
        citiaohuchichuli(true, 1);
        chongduancishu = 0;
        $('#cdcs').html(chongduancishu);
    }
});

$('#choose_zhiye')[0].options[0].selected = true;
$('#b_spawn_xuetong1').click(function () {
    spawnindex = 1;
    var itemModal = $('#spawnid');
    $('#spawnidtitle').html('手动生成材料' + spawnindex);
    t1[0].options[0].selected = true;
    t2[0].options[0].selected = true;
    t3[0].options[0].selected = true;
    t4[0].options[0].selected = true;
    lx1change();
    lx2change();
    itemModal.modal('show');

});

$('#b_spawn_xuetong2').click(function () {
    spawnindex = 2;
    var itemModal = $('#spawnid');
    $('#spawnidtitle').html('手动生成材料' + spawnindex);
    t1[0].options[0].selected = true;
    t2[0].options[0].selected = true;
    t3[0].options[0].selected = true;
    t4[0].options[0].selected = true;
    lx1change();
    lx2change();
    itemModal.modal('show');

});


function choose_zhiye_event() {
    var value = $('#choose_zhiye')[0].value;
    if (value === "碎梦") {
        zhiye = "碎梦";
        zhiyeshuxing = 2;
    } else if (value === "血河") {
        zhiye = "血河";
        zhiyeshuxing = 2;
    } else if (value === "铁衣") {
        zhiye = "铁衣";
        zhiyeshuxing = 2;
    } else if (value === "神相") {
        zhiye = "神相";
        zhiyeshuxing = 1;
    } else if (value === "龙吟") {
        zhiye = "龙吟";
        zhiyeshuxing = 1;
    } else if (value === "素问") {
        zhiye = "素问";
        zhiyeshuxing = 1;
    } else if (value === "九灵") {
        zhiye = "九灵";
        zhiyeshuxing = 1;
    }

    $('#b_choose_zhiye').html("当前职业：" + zhiye);
    maindata.zhiye = {};
    maindata.zhiye.zhiye = zhiye;
    maindata.zhiye.zhiyeshuxing = zhiyeshuxing;
    saveData();

}


$('#b_view_ct1').click(function () {
    citiaohuchichuli(true, 1);
});
$('#b_view_ct2').click(function () {
    citiaohuchichuli(true, 2);
});

$('#to_shengchengwu_xt1').click(function () {
    var flag = $('#hechengbiaoqian').css('visibility');
    if (flag === "hidden") {
        return;
    }

    xuetong1 = hechengwucitiao_;
    xuetong1pingfen = hechengwupingfen_;
    xuetong1pinzhi = hechengwupinzhi_;
    xuetong1leixing1 = hechengwuleixing1_;
    xuetong1leixing2 = hechengwuleixing2_;
    xuetong1extra = hechengwuextra_;
    xuetong1shiyong = hechengwushiyong_;
    xuetong1name = hechengwuname_;
    xuetong1jichu = hechengwujichu;
    xuetong1jichupingfen = hechengwujichupingfen;
    xuetong1citiao = $('#hechengwunamecitiao').html();
    xuetong1chuli();
    citiaohuchichuli(true, 1);
    chongduancishu = 0;
    $('#cdcs').html(chongduancishu);

});

$('#to_shengchengwu_xt2').click(function () {
    var flag = $('#hechengbiaoqian').css('visibility');
    if (flag === "hidden") {
        return;
    }

    xuetong2 = hechengwucitiao_;
    xuetong2pingfen = hechengwupingfen_;
    xuetong2pinzhi = hechengwupinzhi_;
    xuetong2leixing1 = hechengwuleixing1_;
    xuetong2leixing2 = hechengwuleixing2_;
    xuetong2extra = hechengwuextra_;
    xuetong2shiyong = hechengwushiyong_;
    xuetong2name = hechengwuname_;
    xuetong2jichu = hechengwujichu;
    xuetong2jichupingfen = hechengwujichupingfen;
    xuetong2citiao = $('#hechengwunamecitiao').html();
    xuetong2chuli();
    citiaohuchichuli(true, 1);
    chongduancishu = 0;
    $('#cdcs').html(chongduancishu);

});

$('#resetcishu').click(function () {
    chongduancishu = 0;
    $('#cdcs').html(chongduancishu);
});

$('#respawn_xt1').click(function () {
    if (xuetong1.length <= 0) {
        $('#b_spawn_xuetong1').click();
        return;
    }
    spawnindex = 1;
    var itemModal = $('#spawnid');
    $('#spawnidtitle').html('手动生成材料' + spawnindex);
    var index1 = t1[0].options.indexOf(xuetong1pinzhi);
    t1[0].options[index1].selected = true;
    lx1change();
    var index2 = t2[0].options.indexOf(xuetong1leixing1);
    t2[0].options[index2].selected = true;
    lx2change();

    var index3 = t3[0].options.indexOf(xuetong1leixing2);
    t3[0].options[index3].selected = true;
    lx3change();
    t4[0].options[0].selected = true;

    $.each(xuetong1, function (n, v) {
        var t = $('#ct' + (n + 1));
        var index = t[0].options.indexOf(v);
        t[0].options[index].selected = true;
    });

    itemModal.modal('show');
});

$('#respawn_xt2').click(function () {
    if (xuetong2.length <= 0) {
        $('#b_spawn_xuetong2').click();
        return;
    }
    spawnindex = 2;
    var itemModal = $('#spawnid');
    $('#spawnidtitle').html('手动生成材料' + spawnindex);
    var index1 = t1[0].options.indexOf(xuetong2pinzhi);
    t1[0].options[index1].selected = true;
    lx1change();
    var index2 = t2[0].options.indexOf(xuetong2leixing1);
    t2[0].options[index2].selected = true;
    lx2change();

    var index3 = t3[0].options.indexOf(xuetong2leixing2);
    t3[0].options[index3].selected = true;
    lx3change();
    t4[0].options[0].selected = true;

    $.each(xuetong2, function (n, v) {
        var t = $('#ct' + (n + 1));
        var index = t[0].options.indexOf(v);
        t[0].options[index].selected = true;
    });

    itemModal.modal('show');
});

$('#doit').click(function () {
    if (xuetong1.length <= 0 || xuetong2.length <= 0) {
        return;
    }


    var allinone = xuetong1.concat(xuetong2);


    var finalpinzhi, maxpinzhi;
    var fifinalpinzhi;

    if (xuetong1pinzhi === xuetong2pinzhi) {
        finalpinzhi = xuetong1pinzhi;
        maxpinzhi = xuetong1pinzhi;
    } else if ((xuetong1pinzhi === "蓝色" && xuetong2pinzhi === "红色") || (xuetong2pinzhi === "蓝色" && xuetong1pinzhi === "红色")) {
        finalpinzhi = "蓝色,红色";
        maxpinzhi = "红色";
    } else if ((xuetong1pinzhi === "蓝色" && xuetong2pinzhi === "紫色") || (xuetong2pinzhi === "蓝色" && xuetong1pinzhi === "紫色")) {
        finalpinzhi = "蓝色,红色,紫色";
        maxpinzhi = "紫色";
    } else if ((xuetong1pinzhi === "蓝色" && xuetong2pinzhi === "百炼") || (xuetong2pinzhi === "蓝色" && xuetong1pinzhi === "百炼")) {
        finalpinzhi = "蓝色,红色,紫色,百炼";
        maxpinzhi = "百炼";
    } else if ((xuetong1pinzhi === "红色" && xuetong2pinzhi === "紫色") || (xuetong2pinzhi === "红色" && xuetong1pinzhi === "紫色")) {
        finalpinzhi = "红色,紫色";
        maxpinzhi = "紫色";
    } else if ((xuetong1pinzhi === "红色" && xuetong2pinzhi === "百炼") || (xuetong2pinzhi === "红色" && xuetong1pinzhi === "百炼")) {
        finalpinzhi = "红色,紫色,百炼";
        maxpinzhi = "百炼";
    } else if ((xuetong1pinzhi === "紫色" && xuetong2pinzhi === "百炼") || (xuetong2pinzhi === "紫色" && xuetong1pinzhi === "百炼")) {
        finalpinzhi = "紫色,百炼";
        maxpinzhi = "百炼";
    }


    var n1 = random(0, 100);
    var cindex = 0;
    if (n1 <= 49) {
        cindex = 1;
    } else {
        cindex = 2;
    }

    if (maxpinzhi === "百炼") {
        if (xuetong1pinzhi === "百炼" && xuetong1leixing1.indexOf("武器") !== -1 && (xuetong2leixing2.indexOf("戒指") !== -1 || xuetong2leixing1.indexOf("防具") !== -1)) {
            if (cindex === 2) {
                finalpinzhi = finalpinzhi.replace(',百炼', '');
                maxpinzhi = "紫色";
            }
        }
        if (xuetong2pinzhi === "百炼" && xuetong2leixing1.indexOf("武器") !== -1 && (xuetong1leixing2.indexOf("戒指") !== -1 || xuetong1leixing1.indexOf("防具") !== -1)) {
            if (cindex === 1) {
                finalpinzhi = finalpinzhi.replace(',百炼', '');
                maxpinzhi = "紫色";
            }
        }
    }

    //console.log(finalpinzhi);

    if (finalpinzhi.indexOf(',') === -1) {
        fifinalpinzhi = finalpinzhi;
    } else if (finalpinzhi === "蓝色,红色") {
        var n = random(0, 1000);
        if (n <= 400) {
            fifinalpinzhi = "红色";
        } else {
            fifinalpinzhi = "蓝色";
        }
    } else if (finalpinzhi === "蓝色,红色,紫色") {
        var n = random(0, 1000);
        if (n <= 5) {
            fifinalpinzhi = "紫色";
        } else if (n <= 405) {
            fifinalpinzhi = "红色";
        } else {
            fifinalpinzhi = "蓝色";
        }
    } else if (finalpinzhi === "蓝色,红色,紫色,百炼") {
        var n = random(0, 1000);
        if (n <= 1) {
            fifinalpinzhi = "百炼";
        } else if (n <= 45) {
            fifinalpinzhi = "紫色";
        } else if (n <= 775) {
            fifinalpinzhi = "红色";
        } else {
            fifinalpinzhi = "蓝色";
        }
    } else if (finalpinzhi === "红色,紫色") {
        var n = random(0, 1000);
        if (n <= 50) {
            fifinalpinzhi = "紫色";
        } else {
            fifinalpinzhi = "红色";
        }
    } else if (finalpinzhi === "红色,紫色,百炼") {
        var n = random(0, 1000);
        if (n <= 20) {
            fifinalpinzhi = "百炼";
        } else if (n <= 620) {
            fifinalpinzhi = "紫色";
        } else {
            fifinalpinzhi = "红色";
        }
    } else if (finalpinzhi === "紫色,百炼") {
        var n = random(0, 1000);
        if (n <= 400) {
            fifinalpinzhi = "百炼";
        } else {
            fifinalpinzhi = "紫色";
        }
    }


    var hechengwunamepinzhi = $('#hechengwunamepinzhi');
    var hechengwuname = $('#hechengwuname');
    var hechengwunamecitiao = $('#hechengwunamecitiao');
    var hechengwunameshiyong = $('#hechengwunameshiyong');
    var hechengwunameleixing = $('#hechengwunameleixing');
    var hechengwunamepingfen = $('#hechengwunamepingfen');
    var hechengwuextra = $('#hechengwuextra');
    var hechengwujichu_ = $('#hechengwujichu');

    var ret = citiaohuchichuli(false, cindex);
    var keys = [];

    $.each(allinone, function (n, v) {
        if (ret.indexOf(v) !== -1) {
            if (v === '身法' ||
                v === '内功防御' ||
                v === '外功防御' ||
                v === '内功气盾' ||
                v === '外功气盾' ||
                v === '幸运' ||
                v === '最小内功攻击，最大内功攻击' ||
                v === '气海' ||
                v === '内功命中' ||
                v === '内功会心' ||
                v === '最小外功攻击，最大外功攻击' ||
                v === '力量' ||
                v === '外功会心' ||
                v === '外功命中' ||
                v === '根骨' ||
                v === '气血上限' ||
                v === '基础气血百分比' ||
                v === '耐力' ||
                v === '最终伤害' ||
                v === '全元素攻击' ||
                v === '火攻击' ||
                v === '冰攻击' ||
                v === '风攻击' ||
                v === '毒攻击' ||
                v === '阴攻击' ||
                v === '阳攻击' ||
                v === '雷攻击' ||
                v === '血攻击' ||
                v === '土攻击') {
                keys.push(v);
            } else {
                if (keys.indexOf(v) !== -1) {
                    return true;
                } else {
                    if (v.indexOf('固防') !== -1 ||
                        v.indexOf('金汤') !== -1 ||
                        v.indexOf('铁骨') !== -1 ||
                        v.indexOf('厚德') !== -1 ||
                        v.indexOf('纳敏') !== -1 ||
                        v.indexOf('破空') !== -1 ||
                        v.indexOf('益气') !== -1 ||
                        v.indexOf('开碑') !== -1 ||
                        v.indexOf('淬力') !== -1) {
                        var n = random(0, 100);
                        var ib = 0;
                        if (fifinalpinzhi === '百炼') {
                            ib = 8;
                        } else if (fifinalpinzhi === '紫色') {
                            ib = 4;
                        } else if (fifinalpinzhi === '红色') {
                            ib = 2;
                        } else if (fifinalpinzhi === '蓝色') {
                            ib = 1;
                        }
                        if (n <= ib) {
                            keys.push(v);
                        }
                    } else if (v.indexOf('凭风') !== -1) {
                        var n = random(0, 100);
                        var ib = 0;
                        if (fifinalpinzhi === '百炼') {
                            ib = 85;
                        } else if (fifinalpinzhi === '紫色') {
                            ib = 75;
                        } else if (fifinalpinzhi === '红色') {
                            ib = 65;
                        } else if (fifinalpinzhi === '蓝色') {
                            ib = 50;
                        }
                        if (n <= ib) {
                            keys.push(v);
                        }

                    } else {
                        keys.push(v);
                    }
                }
            }

        }
    });


    var maxpinzhicitiaoshuliang = 7;
    if (fifinalpinzhi === "蓝色") {
        maxpinzhicitiaoshuliang = 4;
    } else if (fifinalpinzhi === "红色") {
        maxpinzhicitiaoshuliang = 5;
    } else if (fifinalpinzhi === "紫色") {
        maxpinzhicitiaoshuliang = 6;
    } else if (fifinalpinzhi === "紫色") {
        maxpinzhicitiaoshuliang = 6;
    } else if (fifinalpinzhi === "百炼") {
        maxpinzhicitiaoshuliang = 7;
    }

    var citiaocount1 = xuetong1.length;
    var citiaocount2 = xuetong2.length;

    var finalcount = 7;
    if (citiaocount1 === 2) {
        if (citiaocount2 === 2) {
            finalcount = 2;
            var n = random(0, 1000);
            if (n <= 100) {
                finalcount = 3;
            }
            n = random(0, 1000);
            if (n <= 20) {
                finalcount = 4;
            }
            n = random(0, 2000);
            if (n <= 1) {
                finalcount = 5;
            }
            n = random(0, 20000);
            if (n <= 1) {
                finalcount = 6;
            }
            n = random(0, 50000);
            if (n <= 1) {
                finalcount = 7;
            }
        } else if (citiaocount2 === 3) {
            finalcount = 2;
            var n = random(0, 1000);
            if (n <= 600) {
                finalcount = 3;
            }
            n = random(0, 1000);
            if (n <= 70) {
                finalcount = 4;
            }
            n = random(0, 1000);
            if (n <= 10) {
                finalcount = 5;
            }
            n = random(0, 20000);
            if (n <= 1) {
                finalcount = 6;
            }
            n = random(0, 50000);
            if (n <= 1) {
                finalcount = 7;
            }
        } else if (citiaocount2 === 4) {
            finalcount = 3;
            var n = random(0, 1000);
            if (n <= 200) {
                finalcount = 4;
            }
            n = random(0, 1000);
            if (n <= 1) {
                finalcount = 5;
            }
            n = random(0, 5000);
            if (n <= 1) {
                finalcount = 6;
            }
            n = random(0, 50000);
            if (n <= 1) {
                finalcount = 7;
            }
        } else if (citiaocount2 === 5) {
            finalcount = 3;
            var n = random(0, 1000);
            if (n <= 600) {
                finalcount = 4;
            }
            n = random(0, 1000);
            if (n <= 10) {
                finalcount = 5;
            }
            n = random(0, 5000);
            if (n <= 1) {
                finalcount = 6;
            }
            n = random(0, 50000);
            if (n <= 1) {
                finalcount = 7;
            }
        } else if (citiaocount2 === 6) {
            finalcount = 4;
            var n = random(0, 1000);
            if (n <= 300) {
                finalcount = 5;
            }
            n = random(0, 1000);
            if (n <= 5) {
                finalcount = 6;
            }
            n = random(0, 50000);
            if (n <= 1) {
                finalcount = 7;
            }
        } else if (citiaocount2 === 7) {
            finalcount = 4;
            var n = random(0, 1000);
            if (n <= 600) {
                finalcount = 5;
            }
            n = random(0, 1000);
            if (n <= 20) {
                finalcount = 6;
            }
            n = random(0, 1000);
            if (n <= 1) {
                finalcount = 7;
            }
        }

    } else if (citiaocount1 === 3) {
        if (citiaocount2 === 2) {
            finalcount = 2;
            var n = random(0, 1000);
            if (n <= 600) {
                finalcount = 3;
            }
            n = random(0, 1000);
            if (n <= 70) {
                finalcount = 4;
            }
            n = random(0, 1000);
            if (n <= 10) {
                finalcount = 5;
            }
            n = random(0, 20000);
            if (n <= 1) {
                finalcount = 6;
            }
            n = random(0, 50000);
            if (n <= 1) {
                finalcount = 7;
            }
        } else if (citiaocount2 === 3) {
            finalcount = 3;
            var n = random(0, 1000);
            if (n <= 30) {
                finalcount = 4;
            }
            n = random(0, 2000);
            if (n <= 10) {
                finalcount = 5;
            }
            n = random(0, 10000);
            if (n <= 1) {
                finalcount = 6;
            }
            n = random(0, 50000);
            if (n <= 1) {
                finalcount = 7;
            }
        } else if (citiaocount2 === 4) {
            finalcount = 3;
            var n = random(0, 1000);
            if (n <= 600) {
                finalcount = 4;
            }
            n = random(0, 1000);
            if (n <= 50) {
                finalcount = 5;
            }
            n = random(0, 2000);
            if (n <= 1) {
                finalcount = 6;
            }
            n = random(0, 50000);
            if (n <= 1) {
                finalcount = 7;
            }
        } else if (citiaocount2 === 5) {
            finalcount = 4;
            var n = random(0, 1000);
            if (n <= 200) {
                finalcount = 5;
            }
            n = random(0, 1000);
            if (n <= 1) {
                finalcount = 6;
            }
            n = random(0, 50000);
            if (n <= 1) {
                finalcount = 7;
            }
        } else if (citiaocount2 === 6) {
            finalcount = 4;
            var n = random(0, 1000);
            if (n <= 600) {
                finalcount = 5;
            }
            n = random(0, 1000);
            if (n <= 10) {
                finalcount = 6;
            }
            n = random(0, 50000);
            if (n <= 1) {
                finalcount = 7;
            }
        } else if (citiaocount2 === 7) {
            finalcount = 5;
            var n = random(0, 1000);
            if (n <= 600) {
                finalcount = 6;
            }
            n = random(0, 1000);
            if (n <= 10) {
                finalcount = 7;
            }
        }

    } else if (citiaocount1 === 4) {
        if (citiaocount2 === 2) {
            finalcount = 3;
            var n = random(0, 1000);
            if (n <= 200) {
                finalcount = 4;
            }
            n = random(0, 1000);
            if (n <= 1) {
                finalcount = 5;
            }
            n = random(0, 5000);
            if (n <= 1) {
                finalcount = 6;
            }
            n = random(0, 50000);
            if (n <= 1) {
                finalcount = 7;
            }
        } else if (citiaocount2 === 3) {
            finalcount = 3;
            var n = random(0, 1000);
            if (n <= 600) {
                finalcount = 4;
            }
            n = random(0, 1000);
            if (n <= 50) {
                finalcount = 5;
            }
            n = random(0, 2000);
            if (n <= 1) {
                finalcount = 6;
            }
            n = random(0, 50000);
            if (n <= 1) {
                finalcount = 7;
            }
        } else if (citiaocount2 === 4) {
            finalcount = 4;
            var n = random(0, 1000);
            if (finalpinzhi === "紫色" || finalpinzhi === "紫色,百炼") {
                if (n <= 75) {
                    finalcount = 5;
                }
            } else if (finalpinzhi === "百炼") {
                if (n <= 350) {
                    finalcount = 5;
                }
            }
            if (n <= 100) {
                finalcount = 5;
            }
            n = random(0, 1000);
            if (n <= 5) {
                finalcount = 6;
            }
            n = random(0, 50000);
            if (n <= 1) {
                finalcount = 7;
            }
        } else if (citiaocount2 === 5) {
            finalcount = 4;
            var n = random(0, 1000);
            if (n <= 250) {
                finalcount = 5;
            }
            n = random(0, 2000);
            if (n <= 1) {
                finalcount = 6;
            }
            n = random(0, 50000);
            if (n <= 1) {
                finalcount = 7;
            }
        } else if (citiaocount2 === 6) {
            finalcount = 5;
            var n = random(0, 1000);
            if (n <= 200) {
                finalcount = 6;
            }
            n = random(0, 50000);
            if (n <= 1) {
                finalcount = 7;
            }
        } else if (citiaocount2 === 7) {
            finalcount = 5;
            var n = random(0, 1000);
            if (n <= 600) {
                finalcount = 6;
            }
            n = random(0, 1000);
            if (n <= 10) {
                finalcount = 7;
            }
        }
    } else if (citiaocount1 === 5) {
        if (citiaocount2 === 2) {
            finalcount = 3;
            var n = random(0, 1000);
            if (n <= 600) {
                finalcount = 4;
            }
            n = random(0, 1000);
            if (n <= 10) {
                finalcount = 5;
            }
            n = random(0, 5000);
            if (n <= 1) {
                finalcount = 6;
            }
            n = random(0, 50000);
            if (n <= 1) {
                finalcount = 7;
            }
        } else if (citiaocount2 === 3) {
            finalcount = 4;
            var n = random(0, 1000);
            if (n <= 200) {
                finalcount = 5;
            }
            n = random(0, 1000);
            if (n <= 1) {
                finalcount = 6;
            }
            n = random(0, 50000);
            if (n <= 1) {
                finalcount = 7;
            }
        } else if (citiaocount2 === 4) {
            finalcount = 4;
            var n = random(0, 1000);
            if (n <= 250) {
                finalcount = 5;
            }
            n = random(0, 2000);
            if (n <= 1) {
                finalcount = 6;
            }
            n = random(0, 50000);
            if (n <= 1) {
                finalcount = 7;
            }
        } else if (citiaocount2 === 5) {
            finalcount = 5;
            var n = random(0, 1000);
            if (n <= 150) {
                finalcount = 6;
            }
            n = random(0, 5000);
            if (n <= 1) {
                finalcount = 7;
            }
        } else if (citiaocount2 === 6) {
            finalcount = 5;
            var n = random(0, 1000);
            if (n <= 600) {
                finalcount = 6;
            }
            n = random(0, 2000);
            if (n <= 1) {
                finalcount = 7;
            }
        } else if (citiaocount2 === 7) {
            finalcount = 6;
            var n = random(0, 1000);
            if (n <= 600) {
                finalcount = 7;
            }
        }
    } else if (citiaocount1 === 6) {
        if (citiaocount2 === 2) {
            finalcount = 4;
            var n = random(0, 1000);
            if (n <= 300) {
                finalcount = 5;
            }
            n = random(0, 1000);
            if (n <= 5) {
                finalcount = 6;
            }
            n = random(0, 50000);
            if (n <= 1) {
                finalcount = 7;
            }
        } else if (citiaocount2 === 3) {
            finalcount = 4;
            var n = random(0, 1000);
            if (n <= 600) {
                finalcount = 5;
            }
            n = random(0, 1000);
            if (n <= 10) {
                finalcount = 6;
            }
            n = random(0, 50000);
            if (n <= 1) {
                finalcount = 7;
            }
        } else if (citiaocount2 === 4) {
            finalcount = 5;
            var n = random(0, 1000);
            if (n <= 200) {
                finalcount = 6;
            }
            n = random(0, 50000);
            if (n <= 1) {
                finalcount = 7;
            }
        } else if (citiaocount2 === 5) {
            finalcount = 5;
            var n = random(0, 1000);
            if (n <= 600) {
                finalcount = 6;
            }
            n = random(0, 2000);
            if (n <= 1) {
                finalcount = 7;
            }
        } else if (citiaocount2 === 6) {
            finalcount = 6;
            var n = random(0, 1000);
            if (n <= 180) {
                finalcount = 7;
            }
        } else if (citiaocount2 === 7) {
            finalcount = 6;
            var n = random(0, 1000);
            if (n <= 800) {
                finalcount = 7;
            }
        }
    } else if (citiaocount1 === 7) {
        if (citiaocount2 === 2) {
            finalcount = 4;
            var n = random(0, 1000);
            if (n <= 600) {
                finalcount = 5;
            }
            n = random(0, 1000);
            if (n <= 20) {
                finalcount = 6;
            }
            n = random(0, 1000);
            if (n <= 1) {
                finalcount = 7;
            }
        } else if (citiaocount2 === 3) {
            finalcount = 5;
            var n = random(0, 1000);
            if (n <= 600) {
                finalcount = 6;
            }
            n = random(0, 1000);
            if (n <= 10) {
                finalcount = 7;
            }
        } else if (citiaocount2 === 4) {
            finalcount = 5;
            var n = random(0, 1000);
            if (n <= 600) {
                finalcount = 6;
            }
            n = random(0, 1000);
            if (n <= 10) {
                finalcount = 7;
            }
        } else if (citiaocount2 === 5) {
            finalcount = 6;
            var n = random(0, 1000);
            if (n <= 600) {
                finalcount = 7;
            }
        } else if (citiaocount2 === 6) {
            finalcount = 6;
            var n = random(0, 1000);
            if (n <= 800) {
                finalcount = 7;
            }
        } else if (citiaocount2 === 7) {
            finalcount = 7;

        }
    }


    if (finalcount > maxpinzhicitiaoshuliang) {
        finalcount = maxpinzhicitiaoshuliang;
    }

    if (finalpinzhi === "紫色,百炼") {
        if (fifinalpinzhi === "百炼") {
            if (finalcount < 4)
                finalcount = 4;
        }
    }

    if (finalpinzhi === "百炼") {
        if (finalcount < 4)
            finalcount = 4;

    }


    var allpoint = 0;
    if (cindex === 1) {
        var b = xuetong1leixing1;
        var c = xuetong1leixing2;
        var a = fifinalpinzhi;
        var g = "未知";
        var name = "未知";
        var shengchengwuextra = "";
        if (b === "防具") {
            if (c === "腰带") {
                if (a === "百炼") {
                    name = "百炼·覆舟带";
                } else if (a === "紫色") {
                    name = "楚峡·诗酒年华带";
                } else if (a === "红色") {
                    name = "诗酒年华带";
                } else {
                    name = "鹰击束带";
                }
                g = "全职业";

            } else if (c === "手套") {
                if (a === "百炼") {
                    name = "百炼·琼仙手";
                } else if (a === "紫色") {
                    name = "泸水·奔浪护手";
                } else if (a === "红色") {
                    name = "奔浪护手";
                } else {
                    name = "鹰击护手";
                }
                g = "全职业";

            } else if (c === "鞋子") {
                if (a === "百炼") {
                    name = "百炼·遗玉履";
                } else if (a === "紫色") {
                    name = "天山·清歌逐月履";
                } else if (a === "红色") {
                    name = "清歌逐月履";
                } else {
                    name = "鹰击云靴";
                }
                g = "全职业";

            } else if (c === "皮护腕") {
                if (a === "百炼") {
                    name = "百炼·彭潮束";
                } else if (a === "紫色") {
                    name = "天罡·残夜束";
                } else if (a === "红色") {
                    name = "残夜束";
                } else {
                    name = "横戈裹腕";
                }
                g = "龙吟 碎梦";

            } else if (c === "金属护腕") {
                if (a === "百炼") {
                    name = "百炼·朱鸟腕";
                } else if (a === "紫色") {
                    name = "天柱·阵云臂甲";
                } else if (a === "红色") {
                    name = "阵云臂甲";
                } else {
                    name = "落日臂甲";
                }
                g = "铁衣 血河";

            } else if (c === "布护腕") {
                if (a === "百炼") {
                    name = "百炼·临蔼袖";
                } else if (a === "紫色") {
                    name = "天苑·松雪袖";
                } else if (a === "红色") {
                    name = "清歌逐月履";
                } else {
                    name = "瑞霞袖";
                }
                g = "神相 素问 九灵";

            } else if (c === "皮头盔") {
                if (a === "百炼") {
                    name = "百炼·太平冠";
                } else if (a === "紫色") {
                    name = "天枪·四海八荒冠";
                } else if (a === "红色") {
                    name = "四海八荒冠";
                } else {
                    name = "横戈冠";
                }
                g = "龙吟 碎梦";

            } else if (c === "金属头盔") {
                if (a === "百炼") {
                    name = "百炼·北庭盔";
                } else if (a === "紫色") {
                    name = "天狼·蔽川盔";
                } else if (a === "红色") {
                    name = "蔽川盔";
                } else {
                    name = "落日盔";
                }
                g = "铁衣 血河";

            } else if (c === "布头盔") {
                if (a === "百炼") {
                    name = "百炼·薄悴巾";
                } else if (a === "紫色") {
                    name = "天廪·怜幽巾";
                } else if (a === "红色") {
                    name = "怜幽巾";
                } else {
                    name = "瑞霞巾";
                }
                g = "神相 素问 九灵";

            } else if (c === "皮甲") {
                if (a === "百炼") {
                    name = "百炼·虚南甲";
                } else if (a === "紫色") {
                    name = "天庾·朝星袍";
                } else if (a === "红色") {
                    name = "朝星袍";
                } else {
                    name = "横戈袍";
                }
                g = "龙吟 碎梦";

            } else if (c === "金属铠") {
                if (a === "百炼") {
                    name = "百炼·振鸿铠";
                } else if (a === "紫色") {
                    name = "天纪·楚雄甲";
                } else if (a === "红色") {
                    name = "楚雄甲";
                } else {
                    name = "落日铠";
                }
                g = "铁衣 血河";

            } else if (c === "布甲") {
                if (a === "百炼") {
                    name = "百炼·海枯衫";
                } else if (a === "紫色") {
                    name = "天一·翠微衣";
                } else if (a === "红色") {
                    name = "翠微衣";
                } else {
                    name = "瑞霞衫";
                }
                g = "神相 素问 九灵";

            }
        } else if (xuetong1leixing1.indexOf("武器") !== -1) {
            if (a === "紫色" || a === "百炼") {
                var wuqibujian = {};
                if (a !== xuetong1pinzhi) {
                    var extratext = create_wuqibujian(c, a, wuqibujian);
                } else {
                    var t1 = xuetong1extra.split('<br/>');
                    var pat = />(.{2,4}·.*)</;
                    var a1 = pat.exec(t1[0]);
                    wuqibujian.bujian1name = a1[1];
                    var a1 = pat.exec(t1[1]);
                    wuqibujian.bujian2name = a1[1];
                    var a1 = pat.exec(t1[2]);
                    wuqibujian.bujian3name = a1[1];
                    extratext = xuetong1extra;
                }
                if (wuqibujian.bujian3name.indexOf('蒲元') !== -1) {
                    if (wuqibujian.bujian1name.indexOf('蒲元') !== -1 && wuqibujian.bujian2name.indexOf('蒲元') !== -1) {
                        name = "蒲元·淬厉刀";
                    } else {
                        name = "淬厉刀";
                    }
                    g = "碎梦";
                } else if (wuqibujian.bujian3name.indexOf('豫让') !== -1) {
                    if (wuqibujian.bujian1name.indexOf('豫让') !== -1 && wuqibujian.bujian2name.indexOf('豫让') !== -1) {
                        name = "豫让·金错刀";
                    } else {
                        name = "金错刀";
                    }
                    g = "碎梦";
                } else if (wuqibujian.bujian3name.indexOf('曹彬') !== -1) {
                    if (wuqibujian.bujian1name.indexOf('曹彬') !== -1 && wuqibujian.bujian2name.indexOf('曹彬') !== -1) {
                        name = "曹彬·乱星刀";
                    } else {
                        name = "乱星刀";
                    }
                    g = "碎梦";
                }

                if (wuqibujian.bujian3name.indexOf('高仙芝') !== -1) {
                    if (wuqibujian.bujian1name.indexOf('高仙芝') !== -1 && wuqibujian.bujian2name.indexOf('高仙芝') !== -1) {
                        name = "高仙芝·林暗草惊震";
                    } else {
                        name = "林暗草惊震";
                    }
                    g = "铁衣";
                } else if (wuqibujian.bujian3name.indexOf('马援') !== -1) {
                    if (wuqibujian.bujian1name.indexOf('马援') !== -1 && wuqibujian.bujian2name.indexOf('马援') !== -1) {
                        name = "马援·燕歌塞鸿震";
                    } else {
                        name = "燕歌塞鸿震";
                    }
                    g = "铁衣";
                } else if (wuqibujian.bujian3name.indexOf('张飞') !== -1) {
                    if (wuqibujian.bujian1name.indexOf('张飞') !== -1 && wuqibujian.bujian2name.indexOf('张飞') !== -1) {
                        name = "张飞·虎贲镇岳击";
                    } else {
                        name = "虎贲镇岳击";
                    }
                    g = "铁衣";
                }

                if (wuqibujian.bujian3name.indexOf('王彦章') !== -1) {
                    if (wuqibujian.bujian1name.indexOf('王彦章') !== -1 && wuqibujian.bujian2name.indexOf('王彦章') !== -1) {
                        name = "王彦章·风云铁枪";
                    } else {
                        name = "风云铁枪";
                    }
                    g = "血河";
                } else if (wuqibujian.bujian3name.indexOf('姜维') !== -1) {
                    if (wuqibujian.bujian1name.indexOf('姜维') !== -1 && wuqibujian.bujian2name.indexOf('姜维') !== -1) {
                        name = "姜维·绿沉枪";
                    } else {
                        name = "绿沉枪";
                    }
                    g = "血河";
                } else if (wuqibujian.bujian3name.indexOf('穆桂英') !== -1) {
                    if (wuqibujian.bujian1name.indexOf('穆桂英') !== -1 && wuqibujian.bujian2name.indexOf('穆桂英') !== -1) {
                        name = "穆桂英·暴雨梨花枪";
                    } else {
                        name = "暴雨梨花枪";
                    }
                    g = "血河";
                }

                if (wuqibujian.bujian3name.indexOf('雷海清') !== -1) {
                    if (wuqibujian.bujian1name.indexOf('雷海清') !== -1 && wuqibujian.bujian2name.indexOf('雷海清') !== -1) {
                        name = "雷海清·引梅琴";
                    } else {
                        name = "引梅琴";
                    }
                    g = "神相";
                } else if (wuqibujian.bujian3name.indexOf('张文收') !== -1) {
                    if (wuqibujian.bujian1name.indexOf('张文收') !== -1 && wuqibujian.bujian2name.indexOf('张文收') !== -1) {
                        name = "张文收·景云河清琴";
                    } else {
                        name = "景云河清琴";
                    }
                    g = "神相";
                } else if (wuqibujian.bujian3name.indexOf('蔡邕') !== -1) {
                    if (wuqibujian.bujian1name.indexOf('蔡邕') !== -1 && wuqibujian.bujian2name.indexOf('蔡邕') !== -1) {
                        name = "蔡邕·焦尾琴";
                    } else {
                        name = "焦尾琴";
                    }
                    g = "神相";
                }

                if (wuqibujian.bujian3name.indexOf('徐之才') !== -1) {
                    if (wuqibujian.bujian1name.indexOf('徐之才') !== -1 && wuqibujian.bujian2name.indexOf('徐之才') !== -1) {
                        name = "徐之才·幻生逐月纱";
                    } else {
                        name = "幻生逐月纱";
                    }
                    g = "素问";
                } else if (wuqibujian.bujian3name.indexOf('公乘阳庆') !== -1) {
                    if (wuqibujian.bujian1name.indexOf('公乘阳庆') !== -1 && wuqibujian.bujian2name.indexOf('公乘阳庆') !== -1) {
                        name = "公乘阳庆·璧月珠星纱";
                    } else {
                        name = "璧月珠星纱";
                    }
                    g = "素问";
                } else if (wuqibujian.bujian3name.indexOf('刘涓子') !== -1) {
                    if (wuqibujian.bujian1name.indexOf('刘涓子') !== -1 && wuqibujian.bujian2name.indexOf('刘涓子') !== -1) {
                        name = "刘涓子·蔽月回雪缎";
                    } else {
                        name = "蔽月回雪缎";
                    }
                    g = "素问";
                }

                if (wuqibujian.bujian3name.indexOf('嬴驷') !== -1) {
                    if (wuqibujian.bujian1name.indexOf('嬴驷') !== -1 && wuqibujian.bujian2name.indexOf('嬴驷') !== -1) {
                        name = "嬴驷·刃碎春冰剑";
                    } else {
                        name = "刃碎春冰剑";
                    }
                    g = "龙吟";
                } else if (wuqibujian.bujian3name.indexOf('兰陵老人') !== -1) {
                    if (wuqibujian.bujian1name.indexOf('兰陵老人') !== -1 && wuqibujian.bujian2name.indexOf('兰陵老人') !== -1) {
                        name = "兰陵老人·十载风波剑";
                    } else {
                        name = "十载风波剑";
                    }
                    g = "龙吟";
                } else if (wuqibujian.bujian3name.indexOf('钩弋夫人') !== -1) {
                    if (wuqibujian.bujian1name.indexOf('钩弋夫人') !== -1 && wuqibujian.bujian2name.indexOf('钩弋夫人') !== -1) {
                        name = "钩弋夫人·飞光凌烟剑";
                    } else {
                        name = "飞光凌烟剑";
                    }
                    g = "龙吟";
                }

                if (wuqibujian.bujian3name.indexOf('麻姑') !== -1) {
                    if (wuqibujian.bujian1name.indexOf('麻姑') !== -1 && wuqibujian.bujian2name.indexOf('麻姑') !== -1) {
                        name = "麻姑·虚寂冲应灯";
                    } else {
                        name = "虚寂冲应灯";
                    }
                    g = "九灵";
                } else if (wuqibujian.bujian3name.indexOf('葛洪') !== -1) {
                    if (wuqibujian.bujian1name.indexOf('葛洪') !== -1 && wuqibujian.bujian2name.indexOf('葛洪') !== -1) {
                        name = "葛洪·玉川抱朴灯";
                    } else {
                        name = "玉川抱朴灯";
                    }
                    g = "九灵";
                } else if (wuqibujian.bujian3name.indexOf('葛玄') !== -1) {
                    if (wuqibujian.bujian1name.indexOf('葛玄') !== -1 && wuqibujian.bujian2name.indexOf('葛玄') !== -1) {
                        name = "葛玄·楚吟幽素灯";
                    } else {
                        name = "楚吟幽素灯";
                    }
                    g = "九灵";
                }


                shengchengwuextra = extratext;
            } else if (a === "红色") {
                if (c === "长刀") {
                    name = "白玉刀";
                    g = "碎梦";
                } else if (c === "拳套") {
                    name = "转蓬长风震";
                    g = "铁衣";
                } else if (c === "枪") {
                    name = "落星波荡枪";
                    g = "血河";
                } else if (c === "琴") {
                    name = "玲珑琴";
                    g = "神相";
                } else if (c === "剑") {
                    name = "碧水东流剑";
                    g = "龙吟";
                } else if (c === "丝带") {
                    name = "月冷露华缎";
                    g = "素问";
                } else if (c === "灯笼") {
                    name = "暗霜残夜灯";
                    g = "九灵";
                }
            } else if (a === "蓝色") {
                if (c === "长刀") {
                    name = "优昙刀";
                    g = "碎梦";
                } else if (c === "拳套") {
                    name = "壮志凌云震";
                    g = "铁衣";
                } else if (c === "枪") {
                    name = "驻马枪";
                    g = "血河";
                } else if (c === "琴") {
                    name = "苏息琴";
                    g = "神相";
                } else if (c === "剑") {
                    name = "留岚剑";
                    g = "龙吟";
                } else if (c === "丝带") {
                    name = "珠玑缎";
                    g = "素问";
                } else if (c === "灯笼") {
                    name = "枯兰魂灯";
                    g = "九灵";
                }
            }

        } else {
            if (c === "内功手镯") {
                if (a === "百炼") {
                    name = "百炼·庭霜镯";
                } else if (a === "紫色") {
                    name = "竹枝词·芳夜镯";
                } else if (a === "红色") {
                    name = "芳夜镯";
                } else {
                    name = "丹心镯";
                }
                g = "内功职业";
            } else if (c === "内功戒指") {
                if (a === "百炼") {
                    name = "百炼·晴沙戒";
                } else if (a === "紫色") {
                    name = "水云游·云端戒";
                } else if (a === "红色") {
                    name = "云端戒";
                } else {
                    name = "丹心戒";
                }
                g = "内功职业";
            } else if (c === "内功项链") {
                if (a === "百炼") {
                    name = "百炼·岁寒坠";
                } else if (a === "紫色") {
                    name = "松梢月·玄泽之坠";
                } else if (a === "红色") {
                    name = "玄泽之坠";
                } else {
                    name = "丹心吊坠";
                }
                g = "内功职业";
            } else if (c === "外功手镯") {
                if (a === "百炼") {
                    name = "百炼·寒山镯";
                } else if (a === "紫色") {
                    name = "清商怨·九渊镯";
                } else if (a === "红色") {
                    name = "九渊镯";
                } else {
                    name = "落梅镯";
                }
                g = "外功职业";
            } else if (c === "外功戒指") {
                if (a === "百炼") {
                    name = "百炼·晚梅戒";
                } else if (a === "紫色") {
                    name = "阳春曲·青帝戒";
                } else if (a === "红色") {
                    name = "青帝戒";
                } else {
                    name = "落梅戒";
                }
                g = "外功职业";
            } else if (c === "外功项链") {
                if (a === "百炼") {
                    name = "百炼·寇风坠";
                } else if (a === "紫色") {
                    name = "临江仙·遗芳之坠";
                } else if (a === "红色") {
                    name = "遗芳之坠";
                } else {
                    name = "落梅吊坠";
                }
                g = "外功职业";
            }

        }

        if (fifinalpinzhi === "蓝色") {
            removeandadd(hechengwunamepinzhi, 4);
            removeandadd(hechengwuname, 4);
            removeandadd(hechengwunamecitiao, 4);
        } else if (fifinalpinzhi === "红色") {
            removeandadd(hechengwunamepinzhi, 5);
            removeandadd(hechengwuname, 5);
            removeandadd(hechengwunamecitiao, 5);
        } else if (fifinalpinzhi === "紫色" || fifinalpinzhi === "百炼") {
            removeandadd(hechengwuname, 6);
            removeandadd(hechengwunamepinzhi, 6);
            removeandadd(hechengwunamecitiao, 6);
        }

        var t = "";
        var finalcitiao = [];
        var count = keys.length - 1;
        var youxiaocitiao = unique(keys);
        var originkeys = keys.concat();
        //console.log(youxiaocitiao);
        /*while (finalcount > youxiaocitiao.length) {

            var txu = [];
            var meiyong = 0;
            if (b === "防具") {
                create_fangju(4, txu, meiyong, a);
            } else if (b === "内功武器") {
                create_neigongwuqi(4, txu, meiyong, a, c);
            } else if (b === "外功武器") {
                create_waigongwuqi(4, txu, meiyong, a, c);
            } else if (b === "内功首饰") {
                create_neigongshoushi(4, txu, meiyong, a, c);
            } else if (b === "外功首饰") {
                create_waigongshoushi(4, txu, meiyong, a, c);
            }
            keys.push(txu[0]);
            youxiaocitiao = unique(keys);

        }*/
        keys.push('神秘词条');
        //console.log('finalcount:' + finalcount);
        for (var i = 0; i < finalcount; i++) {
            var allrandnum = 0;
            var numtemp = 0;
            var allrand = [];
            var randnum = 0;
            $.each(keys, function (n, v) {
                if (b === "防具") {
                    randnum = fangjucitiao[v];
                } else if (b.indexOf('外功武器') !== -1) {
                    if (v.indexOf('技能') !== -1 || v.indexOf('心法') !== -1) {
                        randnum = waigongjinengcitiao[v];
                    } else {
                        randnum = waigongwuqicitiao[v];
                    }
                } else if (b.indexOf('内功武器') !== -1) {
                    if (v.indexOf('技能') !== -1 || v.indexOf('心法') !== -1) {
                        randnum = neigongjinengcitiao[v];
                    } else {
                        randnum = neigongwuqicitiao[v];
                    }
                } else if (b.indexOf('外功首饰') !== -1) {
                    if (v.indexOf('技能') !== -1 || v.indexOf('心法') !== -1) {
                        randnum = waigongjinengcitiao[v];
                    } else {
                        randnum = waigongshoushigongjicitiao[v];
                    }
                } else if (b.indexOf('内功首饰') !== -1) {
                    if (v.indexOf('技能') !== -1 || v.indexOf('心法') !== -1) {
                        randnum = neigongjinengcitiao[v];
                    } else {
                        randnum = neigongshoushigongjicitiao[v];
                    }
                }

                if (finalcitiao.indexOf(v) === -1) {
                    allrandnum += randnum[0];
                    allrand.push(randnum[0]);
                } else {
                    allrandnum += randnum[0] - randnum[1];
                    allrand.push(randnum[0] - randnum[1]);
                }

            });

            //console.log(keys);
            //console.log(allrand);
            //console.log('i:' + i);


            var n = random(0, allrandnum);
            numtemp = 0;
            var finalrand = 0;
            for (var ii = 0; ii < allrand.length; ii++) {
                numtemp += allrand[ii];
                if (n <= numtemp) {
                    finalrand = ii;
                    break;
                }

            }

            var randcitiao = keys[finalrand];
            //console.log(randcitiao);
            if (randcitiao === "神秘词条") {
                if (((i + 1) <= youxiaocitiao.length) && keys.length > 1) {
                    while (randcitiao === "神秘词条") {
                        n = random(0, allrandnum);
                        numtemp = 0;
                        finalrand = 0;
                        for (var ii = 0; ii < allrand.length; ii++) {
                            numtemp += allrand[ii];
                            if (n <= numtemp) {
                                finalrand = ii;
                                break;
                            }

                        }
                        randcitiao = keys[finalrand];
                    }
                    keys.splice(finalrand, 1);
                } else {
                    var txu = [];
                    var meiyong = 0;
                    var tcdcs = chongduancishu;
                    if (b === "防具") {
                        create_fangju(4, txu, meiyong, a);
                    } else if (b === "内功武器") {
                        create_neigongwuqi(4, txu, meiyong, a, c);
                    } else if (b === "外功武器") {
                        create_waigongwuqi(4, txu, meiyong, a, c);
                    } else if (b === "内功首饰") {
                        create_neigongshoushi(4, txu, meiyong, a, c);
                    } else if (b === "外功首饰") {
                        create_waigongshoushi(4, txu, meiyong, a, c);
                    }
                    randcitiao = txu[0];
                    chongduancishu = tcdcs;
                    keys.splice(finalrand, 1);
                    keys.push('神秘词条');
                }
            } else {
                keys.splice(finalrand, 1);
            }
            //console.log('choose:' + randcitiao);
            finalcitiao.push(randcitiao);


        }

        //console.log(finalcitiao);
        $.each(finalcitiao, function (n, v) {
            var displayvalue = "";
            if (b === "防具") {
                var value = fangjucitiaoshuzhi[v];
                if (value[0] < 1) {
                    var tv1 = value[0] * 1000;
                    var tv2 = value[1] * 1000;
                    var finalvalue = random(tv1, tv2);
                    var tpoint = jisuanfangjupingfen("防具", v, finalvalue, fifinalpinzhi);
                    allpoint += tpoint;
                    finalvalue /= 1000;
                    displayvalue = (finalvalue * 100).toFixed(1) + '%';

                } else {
                    var finalvalue = random(value[0], value[1]);
                    var tpoint = jisuanfangjupingfen("防具", v, finalvalue, fifinalpinzhi);
                    allpoint += tpoint;
                    displayvalue = parseInt(finalvalue);
                }
            } else {
                var value;
                if (v.indexOf("技能") !== -1 || v.indexOf("心法") !== -1) {
                    if (b === "内功武器" || b === "外功武器") {
                        value = wuqijinengcitiaochuzhi[v];
                    } else {
                        value = shoushijinengcitiaochuzhi[v];
                    }
                } else {
                    value = gongjicitiaoshuzhi[v];
                }
                if (value[0] < 1) {
                    var tv1 = value[0] * 1000;
                    var tv2 = value[1] * 1000;
                    var finalvalue = random(tv1, tv2);
                    var tpoint = jisuanfangjupingfen(c, v, finalvalue, fifinalpinzhi);
                    allpoint += tpoint;
                    finalvalue /= 1000;
                    if (v.indexOf("最小基础") !== -1 || v.indexOf("最大基础") !== -1) {
                        displayvalue = (finalvalue * 100).toFixed(0) + '.0%';
                    } else {
                        displayvalue = (finalvalue * 100).toFixed(1) + '%';
                    }
                } else {
                    var finalvalue = random(value[0], value[1]);
                    var tpoint = jisuanfangjupingfen(c, v, finalvalue, fifinalpinzhi);
                    allpoint += tpoint;
                    displayvalue = parseInt(finalvalue);
                }

            }
            t += v + '：+' + displayvalue + '<br/>';

        });
        /*
                if (c === "腰带") {
                    allpoint *= 1.25;
                } else if (c === "手套") {
                    allpoint *= 1.8;
                } else if (c === "鞋子") {
                    allpoint *= 2.1;
                } else if (c === "皮护腕") {
                    allpoint *= 1.4;
                } else if (c === "金属护腕") {
                    allpoint *= 1.4;
                } else if (c === "布护腕") {
                    allpoint *= 1.4;
                } else if (c === "皮头盔") {
                    allpoint *= 1.3;
                } else if (c === "金属头盔") {
                    allpoint *= 1.3;
                } else if (c === "布头盔") {
                    allpoint *= 1.3;
                } else if (c === "皮甲") {
                    allpoint *= 1.6;
                } else if (c === "金属铠") {
                    allpoint *= 1.6;
                } else if (c === "布甲") {
                    allpoint *= 1.6;
                }
        */

        hechengwucitiao_ = finalcitiao;
        if (finalcount === 7) {
            name += '·无极';
        }
        hechengwuname_ = name;
        hechengwupinzhi_ = a;
        hechengwuleixing1_ = b;
        hechengwuleixing2_ = c;
        hechengwuextra_ = shengchengwuextra;
        hechengwushiyong_ = g;

        var tpoint = [];
        var adds = 1;
        $.each(hechengwucitiao_, function (n, v) {
            if (v.indexOf('逆水') !== -1) {
                adds += 0.3;
            }

            if (v.indexOf('凭风') !== -1) {
                adds += 0.15;
            }

        });
        hechengwujichu = create_jichushuxing(b, c, fifinalpinzhi, shengchengwuextra, tpoint, adds);
        allpoint += tpoint[0];
        hechengwujichupingfen = tpoint[0];
        hechengwupingfen_ = allpoint;

        hechengwujichu_.html(hechengwujichu);
        hechengwunamecitiao.html(t);
        hechengwunamepinzhi.html(fifinalpinzhi);
        hechengwunameshiyong.html('适用职业：' + g);
        hechengwuname.html(name);
        hechengwunameleixing.html(xuetong1leixing2);
        hechengwunamepingfen.html('评分：' + parseInt(allpoint));


    } else {
        var b = xuetong2leixing1;
        var c = xuetong2leixing2;
        var a = fifinalpinzhi;
        var g = "未知";
        var name = "未知";
        var shengchengwuextra = "";
        if (b === "防具") {
            if (c === "腰带") {
                if (a === "百炼") {
                    name = "百炼·覆舟带";
                } else if (a === "紫色") {
                    name = "楚峡·诗酒年华带";
                } else if (a === "红色") {
                    name = "诗酒年华带";
                } else {
                    name = "鹰击束带";
                }
                g = "全职业";
            } else if (c === "手套") {
                if (a === "百炼") {
                    name = "百炼·琼仙手";
                } else if (a === "紫色") {
                    name = "泸水·奔浪护手";
                } else if (a === "红色") {
                    name = "奔浪护手";
                } else {
                    name = "鹰击护手";
                }
                g = "全职业";
            } else if (c === "鞋子") {
                if (a === "百炼") {
                    name = "百炼·遗玉履";
                } else if (a === "紫色") {
                    name = "天山·清歌逐月履";
                } else if (a === "红色") {
                    name = "清歌逐月履";
                } else {
                    name = "鹰击云靴";
                }
                g = "全职业";
            } else if (c === "皮护腕") {
                if (a === "百炼") {
                    name = "百炼·彭潮束";
                } else if (a === "紫色") {
                    name = "天罡·残夜束";
                } else if (a === "红色") {
                    name = "残夜束";
                } else {
                    name = "横戈裹腕";
                }
                g = "龙吟 碎梦";
            } else if (c === "金属护腕") {
                if (a === "百炼") {
                    name = "百炼·朱鸟腕";
                } else if (a === "紫色") {
                    name = "天柱·阵云臂甲";
                } else if (a === "红色") {
                    name = "阵云臂甲";
                } else {
                    name = "落日臂甲";
                }
                g = "铁衣 血河";
            } else if (c === "布护腕") {
                if (a === "百炼") {
                    name = "百炼·临蔼袖";
                } else if (a === "紫色") {
                    name = "天苑·松雪袖";
                } else if (a === "红色") {
                    name = "清歌逐月履";
                } else {
                    name = "瑞霞袖";
                }
                g = "神相 素问 九灵";
            } else if (c === "皮头盔") {
                if (a === "百炼") {
                    name = "百炼·太平冠";
                } else if (a === "紫色") {
                    name = "天枪·四海八荒冠";
                } else if (a === "红色") {
                    name = "四海八荒冠";
                } else {
                    name = "横戈冠";
                }
                g = "龙吟 碎梦";
            } else if (c === "金属头盔") {
                if (a === "百炼") {
                    name = "百炼·北庭盔";
                } else if (a === "紫色") {
                    name = "天狼·蔽川盔";
                } else if (a === "红色") {
                    name = "蔽川盔";
                } else {
                    name = "落日盔";
                }
                g = "铁衣 血河";
            } else if (c === "布头盔") {
                if (a === "百炼") {
                    name = "百炼·薄悴巾";
                } else if (a === "紫色") {
                    name = "天廪·怜幽巾";
                } else if (a === "红色") {
                    name = "怜幽巾";
                } else {
                    name = "瑞霞巾";
                }
                g = "神相 素问 九灵";
            } else if (c === "皮甲") {
                if (a === "百炼") {
                    name = "百炼·虚南甲";
                } else if (a === "紫色") {
                    name = "天庾·朝星袍";
                } else if (a === "红色") {
                    name = "朝星袍";
                } else {
                    name = "横戈袍";
                }
                g = "龙吟 碎梦";
            } else if (c === "金属铠") {
                if (a === "百炼") {
                    name = "百炼·振鸿铠";
                } else if (a === "紫色") {
                    name = "天纪·楚雄甲";
                } else if (a === "红色") {
                    name = "楚雄甲";
                } else {
                    name = "落日铠";
                }
                g = "铁衣 血河";
            } else if (c === "布甲") {
                if (a === "百炼") {
                    name = "百炼·海枯衫";
                } else if (a === "紫色") {
                    name = "天一·翠微衣";
                } else if (a === "红色") {
                    name = "翠微衣";
                } else {
                    name = "瑞霞衫";
                }
                g = "神相 素问 九灵";
            }
        } else if (xuetong2leixing1.indexOf("武器") !== -1) {
            if (a === "紫色" || a === "百炼") {
                var wuqibujian = {};
                if (a !== xuetong2pinzhi) {
                    var extratext = create_wuqibujian(c, a, wuqibujian);
                } else {
                    var t1 = xuetong2extra.split('<br/>');
                    var pat = />(.{2,4}·.*)</;
                    var a1 = pat.exec(t1[0]);
                    wuqibujian.bujian1name = a1[1];
                    var a1 = pat.exec(t1[1]);
                    wuqibujian.bujian2name = a1[1];
                    var a1 = pat.exec(t1[2]);
                    wuqibujian.bujian3name = a1[1];
                    extratext = xuetong2extra;
                }
                if (wuqibujian.bujian3name.indexOf('蒲元') !== -1) {
                    if (wuqibujian.bujian1name.indexOf('蒲元') !== -1 && wuqibujian.bujian2name.indexOf('蒲元') !== -1) {
                        name = "蒲元·淬厉刀";
                    } else {
                        name = "淬厉刀";
                    }
                    g = "碎梦";
                } else if (wuqibujian.bujian3name.indexOf('豫让') !== -1) {
                    if (wuqibujian.bujian1name.indexOf('豫让') !== -1 && wuqibujian.bujian2name.indexOf('豫让') !== -1) {
                        name = "豫让·金错刀";
                    } else {
                        name = "金错刀";
                    }
                    g = "碎梦";
                } else if (wuqibujian.bujian3name.indexOf('曹彬') !== -1) {
                    if (wuqibujian.bujian1name.indexOf('曹彬') !== -1 && wuqibujian.bujian2name.indexOf('曹彬') !== -1) {
                        name = "曹彬·乱星刀";
                    } else {
                        name = "乱星刀";
                    }
                    g = "碎梦";
                }

                if (wuqibujian.bujian3name.indexOf('高仙芝') !== -1) {
                    if (wuqibujian.bujian1name.indexOf('高仙芝') !== -1 && wuqibujian.bujian2name.indexOf('高仙芝') !== -1) {
                        name = "高仙芝·林暗草惊震";
                    } else {
                        name = "林暗草惊震";
                    }
                    g = "铁衣";
                } else if (wuqibujian.bujian3name.indexOf('马援') !== -1) {
                    if (wuqibujian.bujian1name.indexOf('马援') !== -1 && wuqibujian.bujian2name.indexOf('马援') !== -1) {
                        name = "马援·燕歌塞鸿震";
                    } else {
                        name = "燕歌塞鸿震";
                    }
                    g = "铁衣";
                } else if (wuqibujian.bujian3name.indexOf('张飞') !== -1) {
                    if (wuqibujian.bujian1name.indexOf('张飞') !== -1 && wuqibujian.bujian2name.indexOf('张飞') !== -1) {
                        name = "张飞·虎贲镇岳击";
                    } else {
                        name = "虎贲镇岳击";
                    }
                    g = "铁衣";
                }

                if (wuqibujian.bujian3name.indexOf('王彦章') !== -1) {
                    if (wuqibujian.bujian1name.indexOf('王彦章') !== -1 && wuqibujian.bujian2name.indexOf('王彦章') !== -1) {
                        name = "王彦章·风云铁枪";
                    } else {
                        name = "风云铁枪";
                    }
                    g = "血河";
                } else if (wuqibujian.bujian3name.indexOf('姜维') !== -1) {
                    if (wuqibujian.bujian1name.indexOf('姜维') !== -1 && wuqibujian.bujian2name.indexOf('姜维') !== -1) {
                        name = "姜维·绿沉枪";
                    } else {
                        name = "绿沉枪";
                    }
                    g = "血河";
                } else if (wuqibujian.bujian3name.indexOf('穆桂英') !== -1) {
                    if (wuqibujian.bujian1name.indexOf('穆桂英') !== -1 && wuqibujian.bujian2name.indexOf('穆桂英') !== -1) {
                        name = "穆桂英·暴雨梨花枪";
                    } else {
                        name = "暴雨梨花枪";
                    }
                    g = "血河";
                }

                if (wuqibujian.bujian3name.indexOf('雷海清') !== -1) {
                    if (wuqibujian.bujian1name.indexOf('雷海清') !== -1 && wuqibujian.bujian2name.indexOf('雷海清') !== -1) {
                        name = "雷海清·引梅琴";
                    } else {
                        name = "引梅琴";
                    }
                    g = "神相";
                } else if (wuqibujian.bujian3name.indexOf('张文收') !== -1) {
                    if (wuqibujian.bujian1name.indexOf('张文收') !== -1 && wuqibujian.bujian2name.indexOf('张文收') !== -1) {
                        name = "张文收·景云河清琴";
                    } else {
                        name = "景云河清琴";
                    }
                    g = "神相";
                } else if (wuqibujian.bujian3name.indexOf('蔡邕') !== -1) {
                    if (wuqibujian.bujian1name.indexOf('蔡邕') !== -1 && wuqibujian.bujian2name.indexOf('蔡邕') !== -1) {
                        name = "蔡邕·焦尾琴";
                    } else {
                        name = "焦尾琴";
                    }
                    g = "神相";
                }

                if (wuqibujian.bujian3name.indexOf('徐之才') !== -1) {
                    if (wuqibujian.bujian1name.indexOf('徐之才') !== -1 && wuqibujian.bujian2name.indexOf('徐之才') !== -1) {
                        name = "徐之才·幻生逐月纱";
                    } else {
                        name = "幻生逐月纱";
                    }
                    g = "素问";
                } else if (wuqibujian.bujian3name.indexOf('公乘阳庆') !== -1) {
                    if (wuqibujian.bujian1name.indexOf('公乘阳庆') !== -1 && wuqibujian.bujian2name.indexOf('公乘阳庆') !== -1) {
                        name = "公乘阳庆·璧月珠星纱";
                    } else {
                        name = "璧月珠星纱";
                    }
                    g = "素问";
                } else if (wuqibujian.bujian3name.indexOf('刘涓子') !== -1) {
                    if (wuqibujian.bujian1name.indexOf('刘涓子') !== -1 && wuqibujian.bujian2name.indexOf('刘涓子') !== -1) {
                        name = "刘涓子·蔽月回雪缎";
                    } else {
                        name = "蔽月回雪缎";
                    }
                    g = "素问";
                }

                if (wuqibujian.bujian3name.indexOf('嬴驷') !== -1) {
                    if (wuqibujian.bujian1name.indexOf('嬴驷') !== -1 && wuqibujian.bujian2name.indexOf('嬴驷') !== -1) {
                        name = "嬴驷·刃碎春冰剑";
                    } else {
                        name = "刃碎春冰剑";
                    }
                    g = "龙吟";
                } else if (wuqibujian.bujian3name.indexOf('兰陵老人') !== -1) {
                    if (wuqibujian.bujian1name.indexOf('兰陵老人') !== -1 && wuqibujian.bujian2name.indexOf('兰陵老人') !== -1) {
                        name = "兰陵老人·十载风波剑";
                    } else {
                        name = "十载风波剑";
                    }
                    g = "龙吟";
                } else if (wuqibujian.bujian3name.indexOf('钩弋夫人') !== -1) {
                    if (wuqibujian.bujian1name.indexOf('钩弋夫人') !== -1 && wuqibujian.bujian2name.indexOf('钩弋夫人') !== -1) {
                        name = "钩弋夫人·飞光凌烟剑";
                    } else {
                        name = "飞光凌烟剑";
                    }
                    g = "龙吟";
                }

                if (wuqibujian.bujian3name.indexOf('麻姑') !== -1) {
                    if (wuqibujian.bujian1name.indexOf('麻姑') !== -1 && wuqibujian.bujian2name.indexOf('麻姑') !== -1) {
                        name = "麻姑·虚寂冲应灯";
                    } else {
                        name = "虚寂冲应灯";
                    }
                    g = "九灵";
                } else if (wuqibujian.bujian3name.indexOf('葛洪') !== -1) {
                    if (wuqibujian.bujian1name.indexOf('葛洪') !== -1 && wuqibujian.bujian2name.indexOf('葛洪') !== -1) {
                        name = "葛洪·玉川抱朴灯";
                    } else {
                        name = "玉川抱朴灯";
                    }
                    g = "九灵";
                } else if (wuqibujian.bujian3name.indexOf('葛玄') !== -1) {
                    if (wuqibujian.bujian1name.indexOf('葛玄') !== -1 && wuqibujian.bujian2name.indexOf('葛玄') !== -1) {
                        name = "葛玄·楚吟幽素灯";
                    } else {
                        name = "楚吟幽素灯";
                    }
                    g = "九灵";
                }


                shengchengwuextra = extratext;
            } else if (a === "红色") {
                if (c === "长刀") {
                    name = "白玉刀";
                    g = "碎梦";
                } else if (c === "拳套") {
                    name = "转蓬长风震";
                    g = "铁衣";
                } else if (c === "枪") {
                    name = "落星波荡枪";
                    g = "血河";
                } else if (c === "琴") {
                    name = "玲珑琴";
                    g = "神相";
                } else if (c === "剑") {
                    name = "碧水东流剑";
                    g = "龙吟";
                } else if (c === "丝带") {
                    name = "月冷露华缎";
                    g = "素问";
                } else if (c === "灯笼") {
                    name = "暗霜残夜灯";
                    g = "九灵";
                }
            } else if (a === "蓝色") {
                if (c === "长刀") {
                    name = "优昙刀";
                    g = "碎梦";
                } else if (c === "拳套") {
                    name = "壮志凌云震";
                    g = "铁衣";
                } else if (c === "枪") {
                    name = "驻马枪";
                    g = "血河";
                } else if (c === "琴") {
                    name = "苏息琴";
                    g = "神相";
                } else if (c === "剑") {
                    name = "留岚剑";
                    g = "龙吟";
                } else if (c === "丝带") {
                    name = "珠玑缎";
                    g = "素问";
                } else if (c === "灯笼") {
                    name = "枯兰魂灯";
                    g = "九灵";
                }
            }

        } else {
            if (c === "内功手镯") {
                if (a === "百炼") {
                    name = "百炼·庭霜镯";
                } else if (a === "紫色") {
                    name = "竹枝词·芳夜镯";
                } else if (a === "红色") {
                    name = "芳夜镯";
                } else {
                    name = "丹心镯";
                }
                g = "内功职业";
            } else if (c === "内功戒指") {
                if (a === "百炼") {
                    name = "百炼·晴沙戒";
                } else if (a === "紫色") {
                    name = "水云游·云端戒";
                } else if (a === "红色") {
                    name = "云端戒";
                } else {
                    name = "丹心戒";
                }
                g = "内功职业";
            } else if (c === "内功项链") {
                if (a === "百炼") {
                    name = "百炼·岁寒坠";
                } else if (a === "紫色") {
                    name = "松梢月·玄泽之坠";
                } else if (a === "红色") {
                    name = "玄泽之坠";
                } else {
                    name = "丹心吊坠";
                }
                g = "内功职业";
            } else if (c === "外功手镯") {
                if (a === "百炼") {
                    name = "百炼·寒山镯";
                } else if (a === "紫色") {
                    name = "清商怨·九渊镯";
                } else if (a === "红色") {
                    name = "九渊镯";
                } else {
                    name = "落梅镯";
                }
                g = "外功职业";
            } else if (c === "外功戒指") {
                if (a === "百炼") {
                    name = "百炼·晚梅戒";
                } else if (a === "紫色") {
                    name = "阳春曲·青帝戒";
                } else if (a === "红色") {
                    name = "青帝戒";
                } else {
                    name = "落梅戒";
                }
                g = "外功职业";
            } else if (c === "外功项链") {
                if (a === "百炼") {
                    name = "百炼·寇风坠";
                } else if (a === "紫色") {
                    name = "临江仙·遗芳之坠";
                } else if (a === "红色") {
                    name = "遗芳之坠";
                } else {
                    name = "落梅吊坠";
                }
                g = "外功职业";
            }

        }

        if (fifinalpinzhi === "蓝色") {
            removeandadd(hechengwunamepinzhi, 4);
            removeandadd(hechengwuname, 4);
            removeandadd(hechengwunamecitiao, 4);
        } else if (fifinalpinzhi === "红色") {
            removeandadd(hechengwunamepinzhi, 5);
            removeandadd(hechengwuname, 5);
            removeandadd(hechengwunamecitiao, 5);
        } else if (fifinalpinzhi === "紫色" || fifinalpinzhi === "百炼") {
            removeandadd(hechengwuname, 6);
            removeandadd(hechengwunamepinzhi, 6);
            removeandadd(hechengwunamecitiao, 6);
        }

        var t = "";
        var finalcitiao = [];
        var count = keys.length - 1;
        var youxiaocitiao = unique(keys);
        var originkeys = keys.concat();
        //console.log(youxiaocitiao);
        /*while (finalcount > youxiaocitiao.length) {

            var txu = [];
            var meiyong = 0;
            if (b === "防具") {
                create_fangju(4, txu, meiyong, a);
            } else if (b === "内功武器") {
                create_neigongwuqi(4, txu, meiyong, a, c);
            } else if (b === "外功武器") {
                create_waigongwuqi(4, txu, meiyong, a, c);
            } else if (b === "内功首饰") {
                create_neigongshoushi(4, txu, meiyong, a, c);
            } else if (b === "外功首饰") {
                create_waigongshoushi(4, txu, meiyong, a, c);
            }
            keys.push(txu[0]);
            youxiaocitiao = unique(keys);

        }*/
        keys.push('神秘词条');
        //console.log('finalcount:' + finalcount);
        for (var i = 0; i < finalcount; i++) {
            var allrandnum = 0;
            var numtemp = 0;
            var allrand = [];
            var randnum = 0;
            $.each(keys, function (n, v) {
                if (b === "防具") {
                    randnum = fangjucitiao[v];
                } else if (b.indexOf('外功武器') !== -1) {
                    if (v.indexOf('技能') !== -1 || v.indexOf('心法') !== -1) {
                        randnum = waigongjinengcitiao[v];
                    } else {
                        randnum = waigongwuqicitiao[v];
                    }
                } else if (b.indexOf('内功武器') !== -1) {
                    if (v.indexOf('技能') !== -1 || v.indexOf('心法') !== -1) {
                        randnum = neigongjinengcitiao[v];
                    } else {
                        randnum = neigongwuqicitiao[v];
                    }
                } else if (b.indexOf('外功首饰') !== -1) {
                    if (v.indexOf('技能') !== -1 || v.indexOf('心法') !== -1) {
                        randnum = waigongjinengcitiao[v];
                    } else {
                        randnum = waigongshoushigongjicitiao[v];
                    }
                } else if (b.indexOf('内功首饰') !== -1) {
                    if (v.indexOf('技能') !== -1 || v.indexOf('心法') !== -1) {
                        randnum = neigongjinengcitiao[v];
                    } else {
                        randnum = neigongshoushigongjicitiao[v];
                    }
                }

                if (finalcitiao.indexOf(v) === -1) {
                    allrandnum += randnum[0];
                    allrand.push(randnum[0]);
                } else {
                    allrandnum += randnum[0] - randnum[1];
                    allrand.push(randnum[0] - randnum[1]);
                }

            });

            //console.log(keys);
            //console.log(allrand);
            //console.log('i:' + i);


            var n = random(0, allrandnum);
            numtemp = 0;
            var finalrand = 0;
            for (var ii = 0; ii < allrand.length; ii++) {
                numtemp += allrand[ii];
                if (n <= numtemp) {
                    finalrand = ii;
                    break;
                }

            }

            var randcitiao = keys[finalrand];
            //console.log(randcitiao);
            if (randcitiao === "神秘词条") {
                if (((i + 1) <= youxiaocitiao.length) && keys.length > 1) {
                    while (randcitiao === "神秘词条") {
                        n = random(0, allrandnum);
                        numtemp = 0;
                        finalrand = 0;
                        for (var ii = 0; ii < allrand.length; ii++) {
                            numtemp += allrand[ii];
                            if (n <= numtemp) {
                                finalrand = ii;
                                break;
                            }

                        }
                        randcitiao = keys[finalrand];
                    }
                    keys.splice(finalrand, 1);
                } else {
                    var txu = [];
                    var meiyong = 0;
                    var tcdcs = chongduancishu;
                    if (b === "防具") {
                        create_fangju(4, txu, meiyong, a);
                    } else if (b === "内功武器") {
                        create_neigongwuqi(4, txu, meiyong, a, c);
                    } else if (b === "外功武器") {
                        create_waigongwuqi(4, txu, meiyong, a, c);
                    } else if (b === "内功首饰") {
                        create_neigongshoushi(4, txu, meiyong, a, c);
                    } else if (b === "外功首饰") {
                        create_waigongshoushi(4, txu, meiyong, a, c);
                    }
                    randcitiao = txu[0];
                    chongduancishu = tcdcs;
                    keys.splice(finalrand, 1);
                    keys.push('神秘词条');
                }
            } else {
                keys.splice(finalrand, 1);
            }

            //console.log('choose:' + randcitiao);

            finalcitiao.push(randcitiao);


        }

        //console.log(finalcitiao);
        $.each(finalcitiao, function (n, v) {
            var displayvalue = "";
            if (b === "防具") {
                var value = fangjucitiaoshuzhi[v];
                if (value[0] < 1) {
                    var tv1 = value[0] * 1000;
                    var tv2 = value[1] * 1000;
                    var finalvalue = random(tv1, tv2);
                    var tpoint = jisuanfangjupingfen("防具", v, finalvalue, fifinalpinzhi);
                    allpoint += tpoint;
                    finalvalue /= 1000;
                    displayvalue = (finalvalue * 100).toFixed(1) + '%';

                } else {
                    var finalvalue = random(value[0], value[1]);
                    var tpoint = jisuanfangjupingfen("防具", v, finalvalue, fifinalpinzhi);
                    allpoint += tpoint;
                    displayvalue = parseInt(finalvalue);
                }
            } else {
                var value;
                if (v.indexOf("技能") !== -1 || v.indexOf("心法") !== -1) {
                    if (b === "内功武器" || b === "外功武器") {
                        value = wuqijinengcitiaochuzhi[v];
                    } else {
                        value = shoushijinengcitiaochuzhi[v];
                    }
                } else {
                    value = gongjicitiaoshuzhi[v];
                }
                if (value[0] < 1) {
                    var tv1 = value[0] * 1000;
                    var tv2 = value[1] * 1000;
                    var finalvalue = random(tv1, tv2);
                    var tpoint = jisuanfangjupingfen(c, v, finalvalue, fifinalpinzhi);
                    allpoint += tpoint;
                    finalvalue /= 1000;
                    if (v.indexOf("最小基础") !== -1 || v.indexOf("最大基础") !== -1) {
                        displayvalue = (finalvalue * 100).toFixed(0) + '.0%';
                    } else {
                        displayvalue = (finalvalue * 100).toFixed(1) + '%';
                    }
                } else {
                    var finalvalue = random(value[0], value[1]);
                    var tpoint = jisuanfangjupingfen(c, v, finalvalue, fifinalpinzhi);
                    allpoint += tpoint;
                    displayvalue = parseInt(finalvalue);
                }

            }
            t += v + '：+' + displayvalue + '<br/>';

        });
        /*
                if (b === "防具") {
                    if (c === "腰带") {
                        allpoint *= 1.25;
                    } else if (c === "手套") {
                        allpoint *= 1.8;
                    } else if (c === "鞋子") {
                        allpoint *= 2.1;
                    } else if (c === "皮护腕") {
                        allpoint *= 1.4;
                    } else if (c === "金属护腕") {
                        allpoint *= 1.4;
                    } else if (c === "布护腕") {
                        allpoint *= 1.4;
                    } else if (c === "皮头盔") {
                        allpoint *= 1.3;
                    } else if (c === "金属头盔") {
                        allpoint *= 1.3;
                    } else if (c === "布头盔") {
                        allpoint *= 1.3;
                    } else if (c === "皮甲") {
                        allpoint *= 1.6;
                    } else if (c === "金属铠") {
                        allpoint *= 1.6;
                    } else if (c === "布甲") {
                        allpoint *= 1.6;
                    }
                }
        */
        if (finalcount === 7) {
            name += '·无极';
        }
        hechengwucitiao_ = finalcitiao;
        hechengwuname_ = name;
        hechengwupinzhi_ = a;
        hechengwuleixing1_ = b;
        hechengwuleixing2_ = c;
        hechengwuextra_ = shengchengwuextra;
        hechengwushiyong_ = g;

        var tpoint = [];
        var adds = 1;
        $.each(hechengwucitiao_, function (n, v) {
            if (v.indexOf('逆水') !== -1) {
                adds += 0.3;
            }

            if (v.indexOf('凭风') !== -1) {
                adds += 0.15;
            }

        });
        hechengwujichu = create_jichushuxing(b, c, fifinalpinzhi, shengchengwuextra, tpoint, adds);
        allpoint += tpoint[0];
        hechengwujichupingfen = tpoint[0];
        hechengwupingfen_ = allpoint;
        hechengwujichu_.html(hechengwujichu);
        hechengwunamecitiao.html(t);
        hechengwunamepinzhi.html(fifinalpinzhi);
        hechengwunameshiyong.html('适用职业：' + g);
        hechengwuname.html(name);
        hechengwunameleixing.html(xuetong2leixing2);
        hechengwunamepingfen.html('评分：' + parseInt(allpoint));
    }

    hechengwuextra.html(shengchengwuextra);


    $('#b_view_ct1').css('visibility', 'hidden');
    $('#b_view_ct2').css('visibility', 'hidden');
    $('#hechengbiaoqian').css('visibility', 'visible');
    var xt1card = $('#xt1card');
    xt1card.removeClass('highpoint');
    var xt2card = $('#xt2card');
    xt2card.removeClass('highpoint');
    var shengchengwucard = $('#shengchengwucard');
    shengchengwucard.removeClass('highpoint');
    $('#cailiao1scroll')[0].scrollTop = 0;
    $('#cailiao2scroll')[0].scrollTop = 0;
    $('#hechengwuscroll')[0].scrollTop = 0;
    if (allpoint > xuetong1pingfen) {
        if (allpoint > xuetong2pingfen) {
            shengchengwucard.addClass('highpoint');
        } else {
            xt2card.addClass('highpoint');
        }
    } else {
        if (allpoint > xuetong2pingfen) {
            xt1card.addClass('highpoint');
        } else {
            if (xuetong1pingfen > xuetong2pingfen) {
                xt1card.addClass('highpoint');
            } else {
                xt2card.addClass('highpoint');
            }
        }
    }
    chongduancishu++;
    $('#cdcs').html(chongduancishu);
    new $.zui.Messager('重锻成功！', {
        type: 'success',
        //placement: 'center',
        icon: 'ok-sign'
    }).show();
});

$('#huhuan').click(function () {
    if (xuetong1.length <= 0 || xuetong2.length <= 0) {
        return;
    }
    var txuetong = xuetong1;
    xuetong1 = xuetong2;
    xuetong2 = txuetong;

    var txuetong1pingfen = xuetong1pingfen;
    xuetong1pingfen = xuetong2pingfen;
    xuetong2pingfen = txuetong1pingfen;

    var txuetong1shiyong = xuetong1shiyong;
    xuetong1shiyong = xuetong2shiyong;
    xuetong2shiyong = txuetong1shiyong;

    var txuetong1name = xuetong1name;
    xuetong1name = xuetong2name;
    xuetong2name = txuetong1name;

    var txuetong1leixing1 = xuetong1leixing1;
    xuetong1leixing1 = xuetong2leixing1;
    xuetong2leixing1 = txuetong1leixing1;

    var txuetong1leixing2 = xuetong1leixing2;
    xuetong1leixing2 = xuetong2leixing2;
    xuetong2leixing2 = txuetong1leixing2;

    var txuetong1pinzhi = xuetong1pinzhi;
    xuetong1pinzhi = xuetong2pinzhi;
    xuetong2pinzhi = txuetong1pinzhi;

    var txuetong1citiao = xuetong1citiao;
    xuetong1citiao = xuetong2citiao;
    xuetong2citiao = txuetong1citiao;

    var txuetong1extra = xuetong1extra;
    xuetong1extra = xuetong2extra;
    xuetong2extra = txuetong1extra;

    var txuetong1jichu = xuetong1jichu;
    xuetong1jichu = xuetong2jichu;
    xuetong2jichu = txuetong1jichu;

    var txuetong1jichupingfen = xuetong1jichupingfen;
    xuetong1jichupingfen = xuetong2jichupingfen;
    xuetong2jichupingfen = txuetong1jichupingfen;


    xuetong1chuli();
    xuetong2chuli();
    citiaohuchichuli(true, 1);
});

$('#b_save_xuetong1').click(function () {
    if (xuetong1.length <= 0) {
        return;
    }
    maindata.xuetong1 = {};
    maindata.xuetong1.xuetong1 = xuetong1;
    maindata.xuetong1.xuetong1pingfen = xuetong1pingfen;
    maindata.xuetong1.xuetong1pinzhi = xuetong1pinzhi;
    maindata.xuetong1.xuetong1leixing1 = xuetong1leixing1;
    maindata.xuetong1.xuetong1leixing2 = xuetong1leixing2;
    maindata.xuetong1.xuetong1extra = xuetong1extra;
    maindata.xuetong1.xuetong1shiyong = xuetong1shiyong;
    maindata.xuetong1.xuetong1name = xuetong1name;
    maindata.xuetong1.xuetong1citiao = xuetong1citiao;
    maindata.xuetong1.xuetong1jichu = xuetong1jichu;
    maindata.xuetong1.xuetong1jichupingfen = xuetong1jichupingfen;

    saveData();
    new $.zui.Messager('保存成功！', {
        type: 'success',
        //placement: 'center',
        icon: 'ok-sign'
    }).show();

});

$('#b_save_xuetong2').click(function () {
    if (xuetong2.length <= 0) {
        return;
    }
    maindata.xuetong2 = {};
    maindata.xuetong2.xuetong2 = xuetong2;
    maindata.xuetong2.xuetong2pingfen = xuetong2pingfen;
    maindata.xuetong2.xuetong2pinzhi = xuetong2pinzhi;
    maindata.xuetong2.xuetong2leixing1 = xuetong2leixing1;
    maindata.xuetong2.xuetong2leixing2 = xuetong2leixing2;
    maindata.xuetong2.xuetong2extra = xuetong2extra;
    maindata.xuetong2.xuetong2shiyong = xuetong2shiyong;
    maindata.xuetong2.xuetong2name = xuetong2name;
    maindata.xuetong2.xuetong2citiao = xuetong2citiao;
    maindata.xuetong2.xuetong2jichu = xuetong2jichu;
    maindata.xuetong2.xuetong2jichupingfen = xuetong2jichupingfen;

    saveData();
    new $.zui.Messager('保存成功！', {
        type: 'success',
        //placement: 'center',
        icon: 'ok-sign'
    }).show();

});

$('#b_load_xuetong1').click(function () {

    if (maindata.xuetong1.length <= 0) {
        return;
    }
    xuetong1 = maindata.xuetong1.xuetong1;
    xuetong1pingfen = maindata.xuetong1.xuetong1pingfen;
    xuetong1pinzhi = maindata.xuetong1.xuetong1pinzhi;
    xuetong1leixing1 = maindata.xuetong1.xuetong1leixing1;
    xuetong1leixing2 = maindata.xuetong1.xuetong1leixing2;
    xuetong1extra = maindata.xuetong1.xuetong1extra;
    xuetong1shiyong = maindata.xuetong1.xuetong1shiyong;
    xuetong1name = maindata.xuetong1.xuetong1name;
    xuetong1citiao = maindata.xuetong1.xuetong1citiao;
    xuetong1jichu = maindata.xuetong1.xuetong1jichu;
    xuetong1jichupingfen = maindata.xuetong1.xuetong1jichupingfen;

    new $.zui.Messager('读取成功！', {
        type: 'success',
        //placement: 'center',
        icon: 'ok-sign'
    }).show();
    xuetong1chuli();
    citiaohuchichuli(true, 1);
});

$('#b_load_xuetong2').click(function () {
    if (maindata.xuetong2.length <= 0) {
        return;
    }
    xuetong2 = maindata.xuetong2.xuetong2;
    xuetong2pingfen = maindata.xuetong2.xuetong2pingfen;
    xuetong2pinzhi = maindata.xuetong2.xuetong2pinzhi;
    xuetong2leixing1 = maindata.xuetong2.xuetong2leixing1;
    xuetong2leixing2 = maindata.xuetong2.xuetong2leixing2;
    xuetong2extra = maindata.xuetong2.xuetong2extra;
    xuetong2shiyong = maindata.xuetong2.xuetong2shiyong;
    xuetong2name = maindata.xuetong2.xuetong2name;
    xuetong2citiao = maindata.xuetong2.xuetong2citiao;
    xuetong2jichu = maindata.xuetong2.xuetong2jichu;
    xuetong2jichupingfen = maindata.xuetong2.xuetong2jichupingfen;

    new $.zui.Messager('读取成功！', {
        type: 'success',
        //placement: 'center',
        icon: 'ok-sign'
    }).show();
    xuetong2chuli();
    citiaohuchichuli(true, 1);
});

$('#b_randomspawn_bailian1').click(function () {
    var n = 0;
    var a, b;
    var aa = "";

    var t1;
    var c = "长刀";
    var choosen = $('#randombailian1_choose')[0].value;
    if (choosen === "changdao") {
        b = "外功武器";
        c = "长刀";
    } else if (choosen === "qiang") {
        b = "外功武器";
        c = "枪";
    } else if (choosen === "quantao") {
        b = "外功武器";
        c = "拳套";
    } else if (choosen === "qin") {
        b = "内功武器";
        c = "琴";
    } else if (choosen === "jian") {
        b = "内功武器";
        c = "剑";
    } else if (choosen === "sidai") {
        b = "内功武器";
        c = "丝带";
    } else if (choosen === "denglong") {
        b = "内功武器";
        c = "灯笼";
    }

    var g = "未知";
    var gpoint = [];

    var t_xuetong1;
    xuetong1leixing1 = b;
    xuetong1leixing2 = c;
    xuetong1 = [];
    var count = 2;
    a = "百炼";
    count = 4;

    if (b === "内功武器") {
        var t = chongduancishu;
        t_xuetong1 = create_neigongwuqi(count, xuetong1, gpoint, a, c);
        chongduancishu = t;
    } else if (b === "外功武器") {
        var t = chongduancishu;
        t_xuetong1 = create_waigongwuqi(count, xuetong1, gpoint, a, c);
        chongduancishu = t;
    }
    var name = "未知";
    xuetong1pinzhi = a;
    xuetong1pingfen = gpoint[0];

    var wuqibujian = {};
    var extratext = create_wuqibujian(c, a, wuqibujian);
    if (wuqibujian.bujian3name.indexOf('蒲元') !== -1) {
        if (wuqibujian.bujian1name.indexOf('蒲元') !== -1 && wuqibujian.bujian2name.indexOf('蒲元') !== -1) {
            name = "蒲元·淬厉刀";
        } else {
            name = "淬厉刀";
        }
        g = "碎梦";
    } else if (wuqibujian.bujian3name.indexOf('豫让') !== -1) {
        if (wuqibujian.bujian1name.indexOf('豫让') !== -1 && wuqibujian.bujian2name.indexOf('豫让') !== -1) {
            name = "豫让·金错刀";
        } else {
            name = "金错刀";
        }
        g = "碎梦";
    } else if (wuqibujian.bujian3name.indexOf('曹彬') !== -1) {
        if (wuqibujian.bujian1name.indexOf('曹彬') !== -1 && wuqibujian.bujian2name.indexOf('曹彬') !== -1) {
            name = "曹彬·乱星刀";
        } else {
            name = "乱星刀";
        }
        g = "碎梦";
    }

    if (wuqibujian.bujian3name.indexOf('高仙芝') !== -1) {
        if (wuqibujian.bujian1name.indexOf('高仙芝') !== -1 && wuqibujian.bujian2name.indexOf('高仙芝') !== -1) {
            name = "高仙芝·林暗草惊震";
        } else {
            name = "林暗草惊震";
        }
        g = "铁衣";
    } else if (wuqibujian.bujian3name.indexOf('马援') !== -1) {
        if (wuqibujian.bujian1name.indexOf('马援') !== -1 && wuqibujian.bujian2name.indexOf('马援') !== -1) {
            name = "马援·燕歌塞鸿震";
        } else {
            name = "燕歌塞鸿震";
        }
        g = "铁衣";
    } else if (wuqibujian.bujian3name.indexOf('张飞') !== -1) {
        if (wuqibujian.bujian1name.indexOf('张飞') !== -1 && wuqibujian.bujian2name.indexOf('张飞') !== -1) {
            name = "张飞·虎贲镇岳击";
        } else {
            name = "虎贲镇岳击";
        }
        g = "铁衣";
    }

    if (wuqibujian.bujian3name.indexOf('王彦章') !== -1) {
        if (wuqibujian.bujian1name.indexOf('王彦章') !== -1 && wuqibujian.bujian2name.indexOf('王彦章') !== -1) {
            name = "王彦章·风云铁枪";
        } else {
            name = "风云铁枪";
        }
        g = "血河";
    } else if (wuqibujian.bujian3name.indexOf('姜维') !== -1) {
        if (wuqibujian.bujian1name.indexOf('姜维') !== -1 && wuqibujian.bujian2name.indexOf('姜维') !== -1) {
            name = "姜维·绿沉枪";
        } else {
            name = "绿沉枪";
        }
        g = "血河";
    } else if (wuqibujian.bujian3name.indexOf('穆桂英') !== -1) {
        if (wuqibujian.bujian1name.indexOf('穆桂英') !== -1 && wuqibujian.bujian2name.indexOf('穆桂英') !== -1) {
            name = "穆桂英·暴雨梨花枪";
        } else {
            name = "暴雨梨花枪";
        }
        g = "血河";
    }

    if (wuqibujian.bujian3name.indexOf('雷海清') !== -1) {
        if (wuqibujian.bujian1name.indexOf('雷海清') !== -1 && wuqibujian.bujian2name.indexOf('雷海清') !== -1) {
            name = "雷海清·引梅琴";
        } else {
            name = "引梅琴";
        }
        g = "神相";
    } else if (wuqibujian.bujian3name.indexOf('张文收') !== -1) {
        if (wuqibujian.bujian1name.indexOf('张文收') !== -1 && wuqibujian.bujian2name.indexOf('张文收') !== -1) {
            name = "张文收·景云河清琴";
        } else {
            name = "景云河清琴";
        }
        g = "神相";
    } else if (wuqibujian.bujian3name.indexOf('蔡邕') !== -1) {
        if (wuqibujian.bujian1name.indexOf('蔡邕') !== -1 && wuqibujian.bujian2name.indexOf('蔡邕') !== -1) {
            name = "蔡邕·焦尾琴";
        } else {
            name = "焦尾琴";
        }
        g = "神相";
    }

    if (wuqibujian.bujian3name.indexOf('徐之才') !== -1) {
        if (wuqibujian.bujian1name.indexOf('徐之才') !== -1 && wuqibujian.bujian2name.indexOf('徐之才') !== -1) {
            name = "徐之才·幻生逐月纱";
        } else {
            name = "幻生逐月纱";
        }
        g = "素问";
    } else if (wuqibujian.bujian3name.indexOf('公乘阳庆') !== -1) {
        if (wuqibujian.bujian1name.indexOf('公乘阳庆') !== -1 && wuqibujian.bujian2name.indexOf('公乘阳庆') !== -1) {
            name = "公乘阳庆·璧月珠星纱";
        } else {
            name = "璧月珠星纱";
        }
        g = "素问";
    } else if (wuqibujian.bujian3name.indexOf('刘涓子') !== -1) {
        if (wuqibujian.bujian1name.indexOf('刘涓子') !== -1 && wuqibujian.bujian2name.indexOf('刘涓子') !== -1) {
            name = "刘涓子·蔽月回雪缎";
        } else {
            name = "蔽月回雪缎";
        }
        g = "素问";
    }

    if (wuqibujian.bujian3name.indexOf('嬴驷') !== -1) {
        if (wuqibujian.bujian1name.indexOf('嬴驷') !== -1 && wuqibujian.bujian2name.indexOf('嬴驷') !== -1) {
            name = "嬴驷·刃碎春冰剑";
        } else {
            name = "刃碎春冰剑";
        }
        g = "龙吟";
    } else if (wuqibujian.bujian3name.indexOf('兰陵老人') !== -1) {
        if (wuqibujian.bujian1name.indexOf('兰陵老人') !== -1 && wuqibujian.bujian2name.indexOf('兰陵老人') !== -1) {
            name = "兰陵老人·十载风波剑";
        } else {
            name = "十载风波剑";
        }
        g = "龙吟";
    } else if (wuqibujian.bujian3name.indexOf('钩弋夫人') !== -1) {
        if (wuqibujian.bujian1name.indexOf('钩弋夫人') !== -1 && wuqibujian.bujian2name.indexOf('钩弋夫人') !== -1) {
            name = "钩弋夫人·飞光凌烟剑";
        } else {
            name = "飞光凌烟剑";
        }
        g = "龙吟";
    }

    if (wuqibujian.bujian3name.indexOf('麻姑') !== -1) {
        if (wuqibujian.bujian1name.indexOf('麻姑') !== -1 && wuqibujian.bujian2name.indexOf('麻姑') !== -1) {
            name = "麻姑·虚寂冲应灯";
        } else {
            name = "虚寂冲应灯";
        }
        g = "九灵";
    } else if (wuqibujian.bujian3name.indexOf('葛洪') !== -1) {
        if (wuqibujian.bujian1name.indexOf('葛洪') !== -1 && wuqibujian.bujian2name.indexOf('葛洪') !== -1) {
            name = "葛洪·玉川抱朴灯";
        } else {
            name = "玉川抱朴灯";
        }
        g = "九灵";
    } else if (wuqibujian.bujian3name.indexOf('葛玄') !== -1) {
        if (wuqibujian.bujian1name.indexOf('葛玄') !== -1 && wuqibujian.bujian2name.indexOf('葛玄') !== -1) {
            name = "葛玄·楚吟幽素灯";
        } else {
            name = "楚吟幽素灯";
        }
        g = "九灵";
    }

    var tpoint = [];
    xuetong1extra = extratext;
    var adds = 1;
    $.each(xuetong1, function (n, v) {
        if (v.indexOf('逆水') !== -1) {
            adds += 0.3;
        }

        if (v.indexOf('凭风') !== -1) {
            adds += 0.15;
        }

    });
    xuetong1jichu = create_jichushuxing(b, c, a, xuetong1extra, tpoint, adds);
    xuetong1jichupingfen = tpoint[0];
    xuetong1pingfen += tpoint[0];
    xuetong1name = name;
    xuetong1shiyong = g;
    xuetong1citiao = t_xuetong1;
    xuetong1chuli();
    citiaohuchichuli(true, 1);
    chongduancishu++;
    $('#cdcs').html(chongduancishu);
});

$('#b_randomspawn_xuetong1').click(function () {
    var n = random(0, 100);
    var a, b;
    var aa = "";
    if (n <= 40) {
        b = "防具";
    } else if (n <= 70) {
        n = random(0, 100);
        if (n <= 49) {
            b = "内功武器";
        } else {
            b = "外功武器";
        }
    } else {
        n = random(0, 100);
        if (n <= 49) {
            b = "内功首饰";
        } else {
            b = "外功首饰";
        }
    }
    //b = "内功武器";
    var t1;
    if (b === "防具") {
        t1 = ["皮护腕", "金属护腕", "布护腕", "皮头盔", "金属头盔", "布头盔", "皮甲", "金属铠", "布甲", "腰带", "手套", "鞋子"];
    } else if (b === "内功武器") {
        t1 = ["琴", "剑", "丝带", "灯笼"];
    } else if (b === "外功武器") {
        t1 = ["长刀", "拳套", "枪"];
    } else if (b === "内功首饰") {
        t1 = ["内功手镯", "内功戒指", "内功项链"];
    } else if (b === "外功首饰") {
        t1 = ["外功手镯", "外功戒指", "外功项链"];
    }
    var g = "未知";
    n = random(0, t1.length - 1);
    var c = t1[n];
    n = random(0, 10000);
    var gpoint = [];

    var t_xuetong1;
    xuetong1leixing1 = b;
    xuetong1leixing2 = c;
    xuetong1 = [];

    //n = 1;
    var count = 2;
    if (n <= 800) {
        a = "紫色";
        count = 4;
    } else if (n <= 2000) {
        a = "红色";
        count = 3;
    } else {
        a = "蓝色";
        count = 2;
    }
    if (b === "防具") {
        xuetong1extra = "";
        t_xuetong1 = create_fangju(count, xuetong1, gpoint, a);
    } else if (b === "内功武器") {
        xuetong1extra = "";
        t_xuetong1 = create_neigongwuqi(count, xuetong1, gpoint, a, c);
    } else if (b === "外功武器") {
        xuetong1extra = "";
        t_xuetong1 = create_waigongwuqi(count, xuetong1, gpoint, a, c);
    } else if (b === "内功首饰") {
        xuetong1extra = "";
        t_xuetong1 = create_neigongshoushi(count, xuetong1, gpoint, a, c);
    } else if (b === "外功首饰") {
        xuetong1extra = "";
        t_xuetong1 = create_waigongshoushi(count, xuetong1, gpoint, a, c);
    }
    var name = "未知";
    xuetong1pinzhi = a;
    xuetong1pingfen = gpoint[0];
    if (b === "防具") {
        if (c === "腰带") {
            if (a === "紫色") {
                name = "楚峡·诗酒年华带";
            } else if (a === "红色") {
                name = "诗酒年华带";
            } else {
                name = "鹰击束带";
            }
            g = "全职业";
            //xuetong1pingfen *= 1.25;
        } else if (c === "手套") {
            if (a === "紫色") {
                name = "泸水·奔浪护手";
            } else if (a === "红色") {
                name = "奔浪护手";
            } else {
                name = "鹰击护手";
            }
            g = "全职业";
            //xuetong1pingfen *= 1.8;
        } else if (c === "鞋子") {
            if (a === "紫色") {
                name = "天山·清歌逐月履";
            } else if (a === "红色") {
                name = "清歌逐月履";
            } else {
                name = "鹰击云靴";
            }
            g = "全职业";
            //xuetong1pingfen *= 2.1;
        } else if (c === "皮护腕") {
            if (a === "紫色") {
                name = "天罡·残夜束";
            } else if (a === "红色") {
                name = "残夜束";
            } else {
                name = "横戈裹腕";
            }
            g = "龙吟 碎梦";
            //xuetong1pingfen *= 1.4;
        } else if (c === "金属护腕") {
            if (a === "紫色") {
                name = "天柱·阵云臂甲";
            } else if (a === "红色") {
                name = "阵云臂甲";
            } else {
                name = "落日臂甲";
            }
            g = "铁衣 血河";
            //xuetong1pingfen *= 1.4;
        } else if (c === "布护腕") {
            if (a === "紫色") {
                name = "天苑·松雪袖";
            } else if (a === "红色") {
                name = "清歌逐月履";
            } else {
                name = "瑞霞袖";
            }
            g = "神相 素问 九灵";
            //xuetong1pingfen *= 1.4;
        } else if (c === "皮头盔") {
            if (a === "紫色") {
                name = "天枪·四海八荒冠";
            } else if (a === "红色") {
                name = "四海八荒冠";
            } else {
                name = "横戈冠";
            }
            g = "龙吟 碎梦";
            //xuetong1pingfen *= 1.3;
        } else if (c === "金属头盔") {
            if (a === "紫色") {
                name = "天狼·蔽川盔";
            } else if (a === "红色") {
                name = "蔽川盔";
            } else {
                name = "落日盔";
            }
            g = "铁衣 血河";
            //xuetong1pingfen *= 1.3;
        } else if (c === "布头盔") {
            if (a === "紫色") {
                name = "天廪·怜幽巾";
            } else if (a === "红色") {
                name = "怜幽巾";
            } else {
                name = "瑞霞巾";
            }
            g = "神相 素问 九灵";
            //xuetong1pingfen *= 1.3;
        } else if (c === "皮甲") {
            if (a === "紫色") {
                name = "天庾·朝星袍";
            } else if (a === "红色") {
                name = "朝星袍";
            } else {
                name = "横戈袍";
            }
            g = "龙吟 碎梦";
            //xuetong1pingfen *= 1.6;
        } else if (c === "金属铠") {
            if (a === "紫色") {
                name = "天纪·楚雄甲";
            } else if (a === "红色") {
                name = "楚雄甲";
            } else {
                name = "落日铠";
            }
            g = "铁衣 血河";
            //xuetong1pingfen *= 1.6;
        } else if (c === "布甲") {
            if (a === "紫色") {
                name = "天一·翠微衣";
            } else if (a === "红色") {
                name = "翠微衣";
            } else {
                name = "瑞霞衫";
            }
            g = "神相 素问 九灵";
            //xuetong1pingfen *= 1.6;
        }
    } else if (xuetong1leixing1.indexOf("武器") !== -1) {
        if (a === "紫色") {
            var wuqibujian = {};
            var extratext = create_wuqibujian(c, a, wuqibujian);
            if (wuqibujian.bujian3name.indexOf('蒲元') !== -1) {
                if (wuqibujian.bujian1name.indexOf('蒲元') !== -1 && wuqibujian.bujian2name.indexOf('蒲元') !== -1) {
                    name = "蒲元·淬厉刀";
                } else {
                    name = "淬厉刀";
                }
                g = "碎梦";
            } else if (wuqibujian.bujian3name.indexOf('豫让') !== -1) {
                if (wuqibujian.bujian1name.indexOf('豫让') !== -1 && wuqibujian.bujian2name.indexOf('豫让') !== -1) {
                    name = "豫让·金错刀";
                } else {
                    name = "金错刀";
                }
                g = "碎梦";
            } else if (wuqibujian.bujian3name.indexOf('曹彬') !== -1) {
                if (wuqibujian.bujian1name.indexOf('曹彬') !== -1 && wuqibujian.bujian2name.indexOf('曹彬') !== -1) {
                    name = "曹彬·乱星刀";
                } else {
                    name = "乱星刀";
                }
                g = "碎梦";
            }

            if (wuqibujian.bujian3name.indexOf('高仙芝') !== -1) {
                if (wuqibujian.bujian1name.indexOf('高仙芝') !== -1 && wuqibujian.bujian2name.indexOf('高仙芝') !== -1) {
                    name = "高仙芝·林暗草惊震";
                } else {
                    name = "林暗草惊震";
                }
                g = "铁衣";
            } else if (wuqibujian.bujian3name.indexOf('马援') !== -1) {
                if (wuqibujian.bujian1name.indexOf('马援') !== -1 && wuqibujian.bujian2name.indexOf('马援') !== -1) {
                    name = "马援·燕歌塞鸿震";
                } else {
                    name = "燕歌塞鸿震";
                }
                g = "铁衣";
            } else if (wuqibujian.bujian3name.indexOf('张飞') !== -1) {
                if (wuqibujian.bujian1name.indexOf('张飞') !== -1 && wuqibujian.bujian2name.indexOf('张飞') !== -1) {
                    name = "张飞·虎贲镇岳击";
                } else {
                    name = "虎贲镇岳击";
                }
                g = "铁衣";
            }

            if (wuqibujian.bujian3name.indexOf('王彦章') !== -1) {
                if (wuqibujian.bujian1name.indexOf('王彦章') !== -1 && wuqibujian.bujian2name.indexOf('王彦章') !== -1) {
                    name = "王彦章·风云铁枪";
                } else {
                    name = "风云铁枪";
                }
                g = "血河";
            } else if (wuqibujian.bujian3name.indexOf('姜维') !== -1) {
                if (wuqibujian.bujian1name.indexOf('姜维') !== -1 && wuqibujian.bujian2name.indexOf('姜维') !== -1) {
                    name = "姜维·绿沉枪";
                } else {
                    name = "绿沉枪";
                }
                g = "血河";
            } else if (wuqibujian.bujian3name.indexOf('穆桂英') !== -1) {
                if (wuqibujian.bujian1name.indexOf('穆桂英') !== -1 && wuqibujian.bujian2name.indexOf('穆桂英') !== -1) {
                    name = "穆桂英·暴雨梨花枪";
                } else {
                    name = "暴雨梨花枪";
                }
                g = "血河";
            }

            if (wuqibujian.bujian3name.indexOf('雷海清') !== -1) {
                if (wuqibujian.bujian1name.indexOf('雷海清') !== -1 && wuqibujian.bujian2name.indexOf('雷海清') !== -1) {
                    name = "雷海清·引梅琴";
                } else {
                    name = "引梅琴";
                }
                g = "神相";
            } else if (wuqibujian.bujian3name.indexOf('张文收') !== -1) {
                if (wuqibujian.bujian1name.indexOf('张文收') !== -1 && wuqibujian.bujian2name.indexOf('张文收') !== -1) {
                    name = "张文收·景云河清琴";
                } else {
                    name = "景云河清琴";
                }
                g = "神相";
            } else if (wuqibujian.bujian3name.indexOf('蔡邕') !== -1) {
                if (wuqibujian.bujian1name.indexOf('蔡邕') !== -1 && wuqibujian.bujian2name.indexOf('蔡邕') !== -1) {
                    name = "蔡邕·焦尾琴";
                } else {
                    name = "焦尾琴";
                }
                g = "神相";
            }

            if (wuqibujian.bujian3name.indexOf('徐之才') !== -1) {
                if (wuqibujian.bujian1name.indexOf('徐之才') !== -1 && wuqibujian.bujian2name.indexOf('徐之才') !== -1) {
                    name = "徐之才·幻生逐月纱";
                } else {
                    name = "幻生逐月纱";
                }
                g = "素问";
            } else if (wuqibujian.bujian3name.indexOf('公乘阳庆') !== -1) {
                if (wuqibujian.bujian1name.indexOf('公乘阳庆') !== -1 && wuqibujian.bujian2name.indexOf('公乘阳庆') !== -1) {
                    name = "公乘阳庆·璧月珠星纱";
                } else {
                    name = "璧月珠星纱";
                }
                g = "素问";
            } else if (wuqibujian.bujian3name.indexOf('刘涓子') !== -1) {
                if (wuqibujian.bujian1name.indexOf('刘涓子') !== -1 && wuqibujian.bujian2name.indexOf('刘涓子') !== -1) {
                    name = "刘涓子·蔽月回雪缎";
                } else {
                    name = "蔽月回雪缎";
                }
                g = "素问";
            }

            if (wuqibujian.bujian3name.indexOf('嬴驷') !== -1) {
                if (wuqibujian.bujian1name.indexOf('嬴驷') !== -1 && wuqibujian.bujian2name.indexOf('嬴驷') !== -1) {
                    name = "嬴驷·刃碎春冰剑";
                } else {
                    name = "刃碎春冰剑";
                }
                g = "龙吟";
            } else if (wuqibujian.bujian3name.indexOf('兰陵老人') !== -1) {
                if (wuqibujian.bujian1name.indexOf('兰陵老人') !== -1 && wuqibujian.bujian2name.indexOf('兰陵老人') !== -1) {
                    name = "兰陵老人·十载风波剑";
                } else {
                    name = "十载风波剑";
                }
                g = "龙吟";
            } else if (wuqibujian.bujian3name.indexOf('钩弋夫人') !== -1) {
                if (wuqibujian.bujian1name.indexOf('钩弋夫人') !== -1 && wuqibujian.bujian2name.indexOf('钩弋夫人') !== -1) {
                    name = "钩弋夫人·飞光凌烟剑";
                } else {
                    name = "飞光凌烟剑";
                }
                g = "龙吟";
            }

            if (wuqibujian.bujian3name.indexOf('麻姑') !== -1) {
                if (wuqibujian.bujian1name.indexOf('麻姑') !== -1 && wuqibujian.bujian2name.indexOf('麻姑') !== -1) {
                    name = "麻姑·虚寂冲应灯";
                } else {
                    name = "虚寂冲应灯";
                }
                g = "九灵";
            } else if (wuqibujian.bujian3name.indexOf('葛洪') !== -1) {
                if (wuqibujian.bujian1name.indexOf('葛洪') !== -1 && wuqibujian.bujian2name.indexOf('葛洪') !== -1) {
                    name = "葛洪·玉川抱朴灯";
                } else {
                    name = "玉川抱朴灯";
                }
                g = "九灵";
            } else if (wuqibujian.bujian3name.indexOf('葛玄') !== -1) {
                if (wuqibujian.bujian1name.indexOf('葛玄') !== -1 && wuqibujian.bujian2name.indexOf('葛玄') !== -1) {
                    name = "葛玄·楚吟幽素灯";
                } else {
                    name = "楚吟幽素灯";
                }
                g = "九灵";
            }


            xuetong1extra = extratext;
        } else if (a === "红色") {
            if (c === "长刀") {
                name = "白玉刀";
                g = "碎梦";
            } else if (c === "拳套") {
                name = "转蓬长风震";
                g = "铁衣";
            } else if (c === "枪") {
                name = "落星波荡枪";
                g = "血河";
            } else if (c === "琴") {
                name = "玲珑琴";
                g = "神相";
            } else if (c === "剑") {
                name = "碧水东流剑";
                g = "龙吟";
            } else if (c === "丝带") {
                name = "月冷露华缎";
                g = "素问";
            } else if (c === "灯笼") {
                name = "暗霜残夜灯";
                g = "九灵";
            }
        } else if (a === "蓝色") {
            if (c === "长刀") {
                name = "优昙刀";
                g = "碎梦";
            } else if (c === "拳套") {
                name = "壮志凌云震";
                g = "铁衣";
            } else if (c === "枪") {
                name = "驻马枪";
                g = "血河";
            } else if (c === "琴") {
                name = "苏息琴";
                g = "神相";
            } else if (c === "剑") {
                name = "留岚剑";
                g = "龙吟";
            } else if (c === "丝带") {
                name = "珠玑缎";
                g = "素问";
            } else if (c === "灯笼") {
                name = "枯兰魂灯";
                g = "九灵";
            }
        }

    } else {
        if (c === "内功手镯") {
            if (a === "紫色") {
                name = "竹枝词·芳夜镯";
            } else if (a === "红色") {
                name = "芳夜镯";
            } else {
                name = "丹心镯";
            }
            g = "内功职业";
        } else if (c === "内功戒指") {
            if (a === "紫色") {
                name = "水云游·云端戒";
            } else if (a === "红色") {
                name = "云端戒";
            } else {
                name = "丹心戒";
            }
            g = "内功职业";
        } else if (c === "内功项链") {
            if (a === "紫色") {
                name = "松梢月·玄泽之坠";
            } else if (a === "红色") {
                name = "玄泽之坠";
            } else {
                name = "丹心吊坠";
            }
            g = "内功职业";
        } else if (c === "外功手镯") {
            if (a === "紫色") {
                name = "清商怨·九渊镯";
            } else if (a === "红色") {
                name = "九渊镯";
            } else {
                name = "落梅镯";
            }
            g = "外功职业";
        } else if (c === "外功戒指") {
            if (a === "紫色") {
                name = "阳春曲·青帝戒";
            } else if (a === "红色") {
                name = "青帝戒";
            } else {
                name = "落梅戒";
            }
            g = "外功职业";
        } else if (c === "外功项链") {
            if (a === "紫色") {
                name = "临江仙·遗芳之坠";
            } else if (a === "红色") {
                name = "遗芳之坠";
            } else {
                name = "落梅吊坠";
            }
            g = "外功职业";
        }

    }

    var tpoint = [];
    var adds = 1;
    $.each(xuetong1, function (n, v) {
        if (v.indexOf('逆水') !== -1) {
            adds += 0.3;
        }

        if (v.indexOf('凭风') !== -1) {
            adds += 0.15;
        }

    });
    xuetong1jichu = create_jichushuxing(b, c, a, xuetong1extra, tpoint, adds);
    xuetong1jichupingfen = tpoint[0];
    xuetong1pingfen += tpoint[0];
    xuetong1name = name;
    xuetong1shiyong = g;
    xuetong1citiao = t_xuetong1;
    xuetong1chuli();
    citiaohuchichuli(true, 1);
    chongduancishu = 0;
    $('#cdcs').html(chongduancishu);
});

$('#b_randomspawn_xuetong2').click(function () {
    var n = random(0, 100);
    var a, b;
    var aa = "";
    if (n <= 40) {
        b = "防具";
    } else if (n <= 70) {
        n = random(0, 100);
        if (n <= 49) {
            b = "内功武器";
        } else {
            b = "外功武器";
        }
    } else {
        n = random(0, 100);
        if (n <= 49) {
            b = "内功首饰";
        } else {
            b = "外功首饰";
        }
    }

    var t1;
    if (b === "防具") {
        t1 = ["皮护腕", "金属护腕", "布护腕", "皮头盔", "金属头盔", "布头盔", "皮甲", "金属铠", "布甲", "腰带", "手套", "鞋子"];
    } else if (b === "内功武器") {
        t1 = ["琴", "剑", "丝带", "灯笼"];
    } else if (b === "外功武器") {
        t1 = ["长刀", "拳套", "枪"];
    } else if (b === "内功首饰") {
        t1 = ["内功手镯", "内功戒指", "内功项链"];
    } else if (b === "外功首饰") {
        t1 = ["外功手镯", "外功戒指", "外功项链"];
    }
    var g = "未知";
    n = random(0, t1.length - 1);
    var c = t1[n];
    n = random(0, 10000);
    var gpoint = [];

    var t_xuetong2;
    xuetong2leixing1 = b;
    xuetong2leixing2 = c;
    xuetong2 = [];
    //n = 1;
    var count = 2;
    if (n <= 800) {
        a = "紫色";
        count = 4;
    } else if (n <= 2000) {
        a = "红色";
        count = 3;
    } else {
        a = "蓝色";
        count = 2;
    }
    if (b === "防具") {
        xuetong2extra = "";
        t_xuetong2 = create_fangju(count, xuetong2, gpoint, a);
    } else if (b === "内功武器") {
        xuetong2extra = "";
        t_xuetong2 = create_neigongwuqi(count, xuetong2, gpoint, a, c);
    } else if (b === "外功武器") {
        xuetong2extra = "";
        t_xuetong2 = create_waigongwuqi(count, xuetong2, gpoint, a, c);
    } else if (b === "内功首饰") {
        xuetong2extra = "";
        t_xuetong2 = create_neigongshoushi(count, xuetong2, gpoint, a, c);
    } else if (b === "外功首饰") {
        xuetong2extra = "";
        t_xuetong2 = create_waigongshoushi(count, xuetong2, gpoint, a, c);
    }
    var name = "未知";
    xuetong2pinzhi = a;
    xuetong2pingfen = gpoint[0];
    if (b === "防具") {
        if (c === "腰带") {
            if (a === "紫色") {
                name = "楚峡·诗酒年华带";
            } else if (a === "红色") {
                name = "诗酒年华带";
            } else {
                name = "鹰击束带";
            }
            g = "全职业";
            //xuetong2pingfen *= 1.25;
        } else if (c === "手套") {
            if (a === "紫色") {
                name = "泸水·奔浪护手";
            } else if (a === "红色") {
                name = "奔浪护手";
            } else {
                name = "鹰击护手";
            }
            g = "全职业";
            //xuetong2pingfen *= 1.8;
        } else if (c === "鞋子") {
            if (a === "紫色") {
                name = "天山·清歌逐月履";
            } else if (a === "红色") {
                name = "清歌逐月履";
            } else {
                name = "鹰击云靴";
            }
            g = "全职业";
            //xuetong2pingfen *= 2.1;
        } else if (c === "皮护腕") {
            if (a === "紫色") {
                name = "天罡·残夜束";
            } else if (a === "红色") {
                name = "残夜束";
            } else {
                name = "横戈裹腕";
            }
            g = "龙吟 碎梦";
            //xuetong2pingfen *= 1.4;
        } else if (c === "金属护腕") {
            if (a === "紫色") {
                name = "天柱·阵云臂甲";
            } else if (a === "红色") {
                name = "阵云臂甲";
            } else {
                name = "落日臂甲";
            }
            g = "铁衣 血河";
            //xuetong2pingfen *= 1.4;
        } else if (c === "布护腕") {
            if (a === "紫色") {
                name = "天苑·松雪袖";
            } else if (a === "红色") {
                name = "清歌逐月履";
            } else {
                name = "瑞霞袖";
            }
            g = "神相 素问 九灵";
            //xuetong2pingfen *= 1.4;
        } else if (c === "皮头盔") {
            if (a === "紫色") {
                name = "天枪·四海八荒冠";
            } else if (a === "红色") {
                name = "四海八荒冠";
            } else {
                name = "横戈冠";
            }
            g = "龙吟 碎梦";
            //xuetong2pingfen *= 1.3;
        } else if (c === "金属头盔") {
            if (a === "紫色") {
                name = "天狼·蔽川盔";
            } else if (a === "红色") {
                name = "蔽川盔";
            } else {
                name = "落日盔";
            }
            g = "铁衣 血河";
            //xuetong2pingfen *= 1.3;
        } else if (c === "布头盔") {
            if (a === "紫色") {
                name = "天廪·怜幽巾";
            } else if (a === "红色") {
                name = "怜幽巾";
            } else {
                name = "瑞霞巾";
            }
            g = "神相 素问 九灵";
            //xuetong2pingfen *= 1.3;
        } else if (c === "皮甲") {
            if (a === "紫色") {
                name = "天庾·朝星袍";
            } else if (a === "红色") {
                name = "朝星袍";
            } else {
                name = "横戈袍";
            }
            g = "龙吟 碎梦";
            //xuetong2pingfen *= 1.6;
        } else if (c === "金属铠") {
            if (a === "紫色") {
                name = "天纪·楚雄甲";
            } else if (a === "红色") {
                name = "楚雄甲";
            } else {
                name = "落日铠";
            }
            g = "铁衣 血河";
            //xuetong2pingfen *= 1.6;
        } else if (c === "布甲") {
            if (a === "紫色") {
                name = "天一·翠微衣";
            } else if (a === "红色") {
                name = "翠微衣";
            } else {
                name = "瑞霞衫";
            }
            g = "神相 素问 九灵";
            //xuetong2pingfen *= 1.6;
        }
    } else if (xuetong2leixing1.indexOf("武器") !== -1) {
        if (a === "紫色") {
            var wuqibujian = {};
            var extratext = create_wuqibujian(c, a, wuqibujian);
            if (wuqibujian.bujian3name.indexOf('蒲元') !== -1) {
                if (wuqibujian.bujian1name.indexOf('蒲元') !== -1 && wuqibujian.bujian2name.indexOf('蒲元') !== -1) {
                    name = "蒲元·淬厉刀";
                } else {
                    name = "淬厉刀";
                }
                g = "碎梦";
            } else if (wuqibujian.bujian3name.indexOf('豫让') !== -1) {
                if (wuqibujian.bujian1name.indexOf('豫让') !== -1 && wuqibujian.bujian2name.indexOf('豫让') !== -1) {
                    name = "豫让·金错刀";
                } else {
                    name = "金错刀";
                }
                g = "碎梦";
            } else if (wuqibujian.bujian3name.indexOf('曹彬') !== -1) {
                if (wuqibujian.bujian1name.indexOf('曹彬') !== -1 && wuqibujian.bujian2name.indexOf('曹彬') !== -1) {
                    name = "曹彬·乱星刀";
                } else {
                    name = "乱星刀";
                }
                g = "碎梦";
            }

            if (wuqibujian.bujian3name.indexOf('高仙芝') !== -1) {
                if (wuqibujian.bujian1name.indexOf('高仙芝') !== -1 && wuqibujian.bujian2name.indexOf('高仙芝') !== -1) {
                    name = "高仙芝·林暗草惊震";
                } else {
                    name = "林暗草惊震";
                }
                g = "铁衣";
            } else if (wuqibujian.bujian3name.indexOf('马援') !== -1) {
                if (wuqibujian.bujian1name.indexOf('马援') !== -1 && wuqibujian.bujian2name.indexOf('马援') !== -1) {
                    name = "马援·燕歌塞鸿震";
                } else {
                    name = "燕歌塞鸿震";
                }
                g = "铁衣";
            } else if (wuqibujian.bujian3name.indexOf('张飞') !== -1) {
                if (wuqibujian.bujian1name.indexOf('张飞') !== -1 && wuqibujian.bujian2name.indexOf('张飞') !== -1) {
                    name = "张飞·虎贲镇岳击";
                } else {
                    name = "虎贲镇岳击";
                }
                g = "铁衣";
            }

            if (wuqibujian.bujian3name.indexOf('王彦章') !== -1) {
                if (wuqibujian.bujian1name.indexOf('王彦章') !== -1 && wuqibujian.bujian2name.indexOf('王彦章') !== -1) {
                    name = "王彦章·风云铁枪";
                } else {
                    name = "风云铁枪";
                }
                g = "血河";
            } else if (wuqibujian.bujian3name.indexOf('姜维') !== -1) {
                if (wuqibujian.bujian1name.indexOf('姜维') !== -1 && wuqibujian.bujian2name.indexOf('姜维') !== -1) {
                    name = "姜维·绿沉枪";
                } else {
                    name = "绿沉枪";
                }
                g = "血河";
            } else if (wuqibujian.bujian3name.indexOf('穆桂英') !== -1) {
                if (wuqibujian.bujian1name.indexOf('穆桂英') !== -1 && wuqibujian.bujian2name.indexOf('穆桂英') !== -1) {
                    name = "穆桂英·暴雨梨花枪";
                } else {
                    name = "暴雨梨花枪";
                }
                g = "血河";
            }

            if (wuqibujian.bujian3name.indexOf('雷海清') !== -1) {
                if (wuqibujian.bujian1name.indexOf('雷海清') !== -1 && wuqibujian.bujian2name.indexOf('雷海清') !== -1) {
                    name = "雷海清·引梅琴";
                } else {
                    name = "引梅琴";
                }
                g = "神相";
            } else if (wuqibujian.bujian3name.indexOf('张文收') !== -1) {
                if (wuqibujian.bujian1name.indexOf('张文收') !== -1 && wuqibujian.bujian2name.indexOf('张文收') !== -1) {
                    name = "张文收·景云河清琴";
                } else {
                    name = "景云河清琴";
                }
                g = "神相";
            } else if (wuqibujian.bujian3name.indexOf('蔡邕') !== -1) {
                if (wuqibujian.bujian1name.indexOf('蔡邕') !== -1 && wuqibujian.bujian2name.indexOf('蔡邕') !== -1) {
                    name = "蔡邕·焦尾琴";
                } else {
                    name = "焦尾琴";
                }
                g = "神相";
            }

            if (wuqibujian.bujian3name.indexOf('徐之才') !== -1) {
                if (wuqibujian.bujian1name.indexOf('徐之才') !== -1 && wuqibujian.bujian2name.indexOf('徐之才') !== -1) {
                    name = "徐之才·幻生逐月纱";
                } else {
                    name = "幻生逐月纱";
                }
                g = "素问";
            } else if (wuqibujian.bujian3name.indexOf('公乘阳庆') !== -1) {
                if (wuqibujian.bujian1name.indexOf('公乘阳庆') !== -1 && wuqibujian.bujian2name.indexOf('公乘阳庆') !== -1) {
                    name = "公乘阳庆·璧月珠星纱";
                } else {
                    name = "璧月珠星纱";
                }
                g = "素问";
            } else if (wuqibujian.bujian3name.indexOf('刘涓子') !== -1) {
                if (wuqibujian.bujian1name.indexOf('刘涓子') !== -1 && wuqibujian.bujian2name.indexOf('刘涓子') !== -1) {
                    name = "刘涓子·蔽月回雪缎";
                } else {
                    name = "蔽月回雪缎";
                }
                g = "素问";
            }

            if (wuqibujian.bujian3name.indexOf('嬴驷') !== -1) {
                if (wuqibujian.bujian1name.indexOf('嬴驷') !== -1 && wuqibujian.bujian2name.indexOf('嬴驷') !== -1) {
                    name = "嬴驷·刃碎春冰剑";
                } else {
                    name = "刃碎春冰剑";
                }
                g = "龙吟";
            } else if (wuqibujian.bujian3name.indexOf('兰陵老人') !== -1) {
                if (wuqibujian.bujian1name.indexOf('兰陵老人') !== -1 && wuqibujian.bujian2name.indexOf('兰陵老人') !== -1) {
                    name = "兰陵老人·十载风波剑";
                } else {
                    name = "十载风波剑";
                }
                g = "龙吟";
            } else if (wuqibujian.bujian3name.indexOf('钩弋夫人') !== -1) {
                if (wuqibujian.bujian1name.indexOf('钩弋夫人') !== -1 && wuqibujian.bujian2name.indexOf('钩弋夫人') !== -1) {
                    name = "钩弋夫人·飞光凌烟剑";
                } else {
                    name = "飞光凌烟剑";
                }
                g = "龙吟";
            }

            if (wuqibujian.bujian3name.indexOf('麻姑') !== -1) {
                if (wuqibujian.bujian1name.indexOf('麻姑') !== -1 && wuqibujian.bujian2name.indexOf('麻姑') !== -1) {
                    name = "麻姑·虚寂冲应灯";
                } else {
                    name = "虚寂冲应灯";
                }
                g = "九灵";
            } else if (wuqibujian.bujian3name.indexOf('葛洪') !== -1) {
                if (wuqibujian.bujian1name.indexOf('葛洪') !== -1 && wuqibujian.bujian2name.indexOf('葛洪') !== -1) {
                    name = "葛洪·玉川抱朴灯";
                } else {
                    name = "玉川抱朴灯";
                }
                g = "九灵";
            } else if (wuqibujian.bujian3name.indexOf('葛玄') !== -1) {
                if (wuqibujian.bujian1name.indexOf('葛玄') !== -1 && wuqibujian.bujian2name.indexOf('葛玄') !== -1) {
                    name = "葛玄·楚吟幽素灯";
                } else {
                    name = "楚吟幽素灯";
                }
                g = "九灵";
            }


            xuetong2extra = extratext;
        } else if (a === "红色") {
            if (c === "长刀") {
                name = "白玉刀";
                g = "碎梦";
            } else if (c === "拳套") {
                name = "转蓬长风震";
                g = "铁衣";
            } else if (c === "枪") {
                name = "落星波荡枪";
                g = "血河";
            } else if (c === "琴") {
                name = "玲珑琴";
                g = "神相";
            } else if (c === "剑") {
                name = "碧水东流剑";
                g = "龙吟";
            } else if (c === "丝带") {
                name = "月冷露华缎";
                g = "素问";
            } else if (c === "灯笼") {
                name = "暗霜残夜灯";
                g = "九灵";
            }
        } else if (a === "蓝色") {
            if (c === "长刀") {
                name = "优昙刀";
                g = "碎梦";
            } else if (c === "拳套") {
                name = "壮志凌云震";
                g = "铁衣";
            } else if (c === "枪") {
                name = "驻马枪";
                g = "血河";
            } else if (c === "琴") {
                name = "苏息琴";
                g = "神相";
            } else if (c === "剑") {
                name = "留岚剑";
                g = "龙吟";
            } else if (c === "丝带") {
                name = "珠玑缎";
                g = "素问";
            } else if (c === "灯笼") {
                name = "枯兰魂灯";
                g = "九灵";
            }
        }

    } else {
        if (c === "内功手镯") {
            if (a === "紫色") {
                name = "竹枝词·芳夜镯";
            } else if (a === "红色") {
                name = "芳夜镯";
            } else {
                name = "丹心镯";
            }
            g = "内功职业";
        } else if (c === "内功戒指") {
            if (a === "紫色") {
                name = "水云游·云端戒";
            } else if (a === "红色") {
                name = "云端戒";
            } else {
                name = "丹心戒";
            }
            g = "内功职业";
        } else if (c === "内功项链") {
            if (a === "紫色") {
                name = "松梢月·玄泽之坠";
            } else if (a === "红色") {
                name = "玄泽之坠";
            } else {
                name = "丹心吊坠";
            }
            g = "内功职业";
        } else if (c === "外功手镯") {
            if (a === "紫色") {
                name = "清商怨·九渊镯";
            } else if (a === "红色") {
                name = "九渊镯";
            } else {
                name = "落梅镯";
            }
            g = "外功职业";
        } else if (c === "外功戒指") {
            if (a === "紫色") {
                name = "阳春曲·青帝戒";
            } else if (a === "红色") {
                name = "青帝戒";
            } else {
                name = "落梅戒";
            }
            g = "外功职业";
        } else if (c === "外功项链") {
            if (a === "紫色") {
                name = "临江仙·遗芳之坠";
            } else if (a === "红色") {
                name = "遗芳之坠";
            } else {
                name = "落梅吊坠";
            }
            g = "外功职业";
        }

    }

    var tpoint = [];
    var adds = 1;
    $.each(xuetong2, function (n, v) {
        if (v.indexOf('逆水') !== -1) {
            adds += 0.3;
        }

        if (v.indexOf('凭风') !== -1) {
            adds += 0.15;
        }

    });
    xuetong2jichu = create_jichushuxing(b, c, a, xuetong2extra, tpoint, adds);
    xuetong2jichupingfen = tpoint[0];
    xuetong2pingfen += tpoint[0];
    xuetong2name = name;
    xuetong2shiyong = g;
    xuetong2citiao = t_xuetong2;
    xuetong2chuli();
    citiaohuchichuli(true, 1);
    chongduancishu = 0;
    $('#cdcs').html(chongduancishu);
});

$(function () {
    fangjucitiao_chushihua();
    fangjucitiaoshuzhi_chushihua();
    fangjucitiaopingfen_chushihua();
    gongjicitiaopingfen_chushihua();
    neigongshoushigongjicitiao_chushihua();
    gongjicitiaoshuzhi_chushihua();
    neigongwuqicitiao_chushihua();
    waigongwuqicitiao_chushihua();
    waigongshoushigongjicitiao_chushihua();
    suimengjinengcitiao_chushihua();
    xuehejinengcitiao_chushihua();
    tieyijinengcitiao_chushihua();
    shenxiangjinengcitiao_chushihua();
    longyinjinengcitiao_chushihua();
    suwenjinengcitiao_chushihua();
    jiulingjinengcitiao_chushihua();
    shoushijinengcitiaochuzhi_chushihua();
    wuqijinengcitiaochuzhi_chushihua();
    quanbujinengcitiao_chushihua();
    wuqibujian_chushihua();
    setTimeout(function () {
        readytodo();
    }, 100);
});

function readytodo() {
    if (window.localStorage.data) {
        maindata = JSON.parse(window.localStorage.data);
    } else {
        maindata = {};
    }

    $('#loading').remove();

    var alertTitle = $('#alertTitle');
    var alertContent = $('#alertContent');
    var alertModal = $('#alertModal');
    var first = window.localStorage.firststart;
    if (!first) {
        window.localStorage.firststart = "OK";
        s_alert('提示', 'localStorage');
    }

    var dv = document.getElementById('draggg');
    var x = 0;
    var y = 0;
    var l = 0;
    var t = 0;
    var isDown = false;
    //鼠标按下事件
    dv.onmousedown = function (e) {
        //获取x坐标和y坐标
        x = e.clientX;
        y = e.clientY;

        //获取左部和顶部的偏移量
        l = dv.offsetLeft;
        t = dv.offsetTop;
        //开关打开
        isDown = true;
        //设置样式
        dv.style.cursor = 'move';
    };

    dv.ontouchstart = function (e) {
        //获取x坐标和y坐标
        x = e.touches[0].clientX;
        y = e.touches[0].clientY;

        //获取左部和顶部的偏移量
        l = dv.offsetLeft;
        t = dv.offsetTop;
        //开关打开
        isDown = true;
        //设置样式
        dv.style.cursor = 'move';
    };

    //鼠标移动
    dv.onmousemove = function (e) {
        if (!isDown) {
            return;
        }
        //获取x和y
        var nx = e.clientX;
        var ny = e.clientY;
        //计算移动后的左偏移量和顶部的偏移量
        var nl = nx - (x - l);
        var nt = ny - (y - t);

        dv.style.left = nl + 'px';
        dv.style.top = nt + 'px';
    };

    //鼠标移动
    dv.ontouchmove = function (e) {
        if (!isDown) {
            return;
        }
        //获取x和y
        var nx = e.touches[0].clientX;
        var ny = e.touches[0].clientY;
        //计算移动后的左偏移量和顶部的偏移量
        var nl = nx - (x - l);
        var nt = ny - (y - t);

        dv.style.left = nl + 'px';
        dv.style.top = nt + 'px';
        document.body.addEventListener('touchmove', function (e) {
            e.preventDefault(); //阻止默认的处理方式(阻止下拉滑动的效果)
        }, {
            passive: false
        }); //passive 参数不能省略，用来兼容ios和android
    };

    //鼠标抬起事件
    dv.onmouseup = function () {
        //开关关闭
        isDown = false;
        dv.style.cursor = 'default';
    };

    //鼠标抬起事件
    dv.ontouchend = function () {
        //开关关闭
        isDown = false;
        dv.style.cursor = 'default';
    };


    var keys = Object.keys(fangjucitiao);
    var ct1 = $('#ct1');
    var ct2 = $('#ct2');
    var ct3 = $('#ct3');
    var ct4 = $('#ct4');
    var ct5 = $('#ct5');
    var ct6 = $('#ct6');
    var ct7 = $('#ct7');
    ct1.empty();
    ct2.empty();
    ct3.empty();
    ct4.empty();
    ct5.empty();
    ct6.empty();
    ct7.empty();
    var t = '<option value="无">无</option>';
    ct1.append(t);
    ct2.append(t);
    ct3.append(t);
    ct4.append(t);
    ct5.append(t);
    ct6.append(t);
    ct7.append(t);
    $.each(keys, function (n, v) {
        t = '<option value="' + v + '">' + v + '</option>';
        ct1.append(t);
        ct2.append(t);
        ct3.append(t);
        ct4.append(t);
        ct5.append(t);
        ct6.append(t);
        ct7.append(t);
    });

}

function s_alert(title, content) {
    var alertTitle = $('#alertTitle');
    var alertContent = $('#alertContent');
    var alertModal = $('#alertModal');
    alertTitle.html(title);
    alertContent.html(content);
    alertModal.modal({
        backdrop: 'static',
        keyboard: false,

    });
}

function saveData() {
    window.localStorage.data = JSON.stringify(maindata);
}

function citiaohuchichuli(xianshi, index) {
    if (xuetong1.length <= 0 || xuetong2.length <= 0) {
        return;
    }

    var finalpinzhi, maxpinzhi;
    var ret = [];

    if (xuetong1pinzhi === xuetong2pinzhi) {
        finalpinzhi = xuetong1pinzhi;
        maxpinzhi = xuetong1pinzhi;
    } else if ((xuetong1pinzhi === "蓝色" && xuetong2pinzhi === "红色") || (xuetong2pinzhi === "蓝色" && xuetong1pinzhi === "红色")) {
        finalpinzhi = "蓝色,红色";
        maxpinzhi = "红色";
    } else if ((xuetong1pinzhi === "蓝色" && xuetong2pinzhi === "紫色") || (xuetong2pinzhi === "蓝色" && xuetong1pinzhi === "紫色")) {
        finalpinzhi = "蓝色,红色,紫色";
        maxpinzhi = "紫色";
    } else if ((xuetong1pinzhi === "蓝色" && xuetong2pinzhi === "百炼") || (xuetong2pinzhi === "蓝色" && xuetong1pinzhi === "百炼")) {
        finalpinzhi = "蓝色,红色,紫色,百炼";
        maxpinzhi = "百炼";
    } else if ((xuetong1pinzhi === "红色" && xuetong2pinzhi === "紫色") || (xuetong2pinzhi === "红色" && xuetong1pinzhi === "紫色")) {
        finalpinzhi = "红色,紫色";
        maxpinzhi = "紫色";
    } else if ((xuetong1pinzhi === "红色" && xuetong2pinzhi === "百炼") || (xuetong2pinzhi === "红色" && xuetong1pinzhi === "百炼")) {
        finalpinzhi = "红色,紫色,百炼";
        maxpinzhi = "百炼";
    } else if ((xuetong1pinzhi === "紫色" && xuetong2pinzhi === "百炼") || (xuetong2pinzhi === "紫色" && xuetong1pinzhi === "百炼")) {
        finalpinzhi = "紫色,百炼";
        maxpinzhi = "百炼";
    }

    var maxpinzhicitiaoshuliang = 0;
    if (maxpinzhi === "蓝色") {
        maxpinzhicitiaoshuliang = 4;
    } else if (maxpinzhi === "红色") {
        maxpinzhicitiaoshuliang = 5;
    } else if (maxpinzhi === "紫色") {
        maxpinzhicitiaoshuliang = 6;
    } else if (maxpinzhi === "百炼") {
        maxpinzhicitiaoshuliang = 7;
    }

    var hechengwunamepinzhi = $('#hechengwunamepinzhi');
    var hechengwuname = $('#hechengwuname');
    var hechengwunamecitiao = $('#hechengwunamecitiao');
    var hechengwunameshiyong = $('#hechengwunameshiyong');
    var hechengwunameleixing = $('#hechengwunameleixing');
    var hechengwunamepingfen = $('#hechengwunamepingfen');
    var hechengwuextra = $('#hechengwuextra');
    var hechengwujichu_ = $('#hechengwujichu');
    var adds = 1;


    var leixing1, leixing2, pinzhi;
    if (xianshi) {
        if (index === 1) {
            leixing1 = xuetong1leixing1;
            leixing2 = xuetong1leixing2;
        } else {
            leixing1 = xuetong2leixing1;
            leixing2 = xuetong2leixing2;
        }
        pinzhi = maxpinzhi;
    }
    var apoint = 0;


    if (xuetong1leixing1 === xuetong2leixing1) {
        if (xianshi) {
            $('#hechengbiaoqian').css('visibility', 'hidden');
            $('#xt1card').removeClass('highpoint');
            $('#xt2card').removeClass('highpoint');
            $('#shengchengwucard').removeClass('highpoint');
            if (xuetong1leixing2 === xuetong2leixing2) {
                $('#b_view_ct1').css('width', '100%');
                $('#b_view_ct1').css('visibility', 'visible');
                $('#b_view_ct2').css('visibility', 'hidden');
            } else {
                $('#b_view_ct1').css('width', '');
                $('#b_view_ct1').css('visibility', 'visible');
                $('#b_view_ct2').css('visibility', 'visible');
            }
        }
        if (xuetong1leixing1 === "防具") {
            var allinone = [];
            allinone = xuetong1.concat(xuetong2);
            allinone = unique(allinone);
            var t = "";
            var allpoint = 0;
            $.each(allinone, function (n, v) {
                t += v + "：+???<br/>";
                ret.push(v);
                var t2 = (fangjucitiaoshuzhi[v][0] + fangjucitiaoshuzhi[v][1]) / 2;
                var tpoint = jisuanfangjupingfen(xuetong1leixing1, v, t2, maxpinzhi);
                allpoint += tpoint;
            });

            var ct = allinone.length;
            if (ct < maxpinzhicitiaoshuliang) {
                for (var i = 0; i < maxpinzhicitiaoshuliang - c + 1; i++) {
                    t += "神秘词条：+???<br/>";
                }

            }
            if (ct < 4) {
                var t8 = 600;
                if (index === 1) {
                    if (xuetong1leixing2.indexOf('戒指') !== -1) {
                        t8 *= 0.6;
                    } else if (xuetong1leixing2.indexOf('手镯') !== -1) {
                        t8 *= 0.7;
                    } else if (xuetong1leixing2.indexOf('项链') !== -1) {
                        t8 *= 1.3;
                    } else {
                        t8 *= 1.3;
                    }
                } else {
                    if (xuetong2leixing2.indexOf('戒指') !== -1) {
                        t8 *= 0.6;
                    } else if (xuetong2leixing2.indexOf('手镯') !== -1) {
                        t8 *= 0.7;
                    } else if (xuetong2leixing2.indexOf('项链') !== -1) {
                        t8 *= 1.3;
                    } else {
                        t8 *= 1.3;
                    }

                }

                allpoint += t8;
            }

            var c;
            if (index === 1) {
                c = xuetong1leixing2;
            } else {
                c = xuetong2leixing2;
            }
            /*
            if (c === "腰带") {
                allpoint *= 1.25;
            } else if (c === "手套") {
                allpoint *= 1.8;
            } else if (c === "鞋子") {
                allpoint *= 2.1;
            } else if (c === "皮护腕") {
                allpoint *= 1.4;
            } else if (c === "金属护腕") {
                allpoint *= 1.4;
            } else if (c === "布护腕") {
                allpoint *= 1.4;
            } else if (c === "皮头盔") {
                allpoint *= 1.3;
            } else if (c === "金属头盔") {
                allpoint *= 1.3;
            } else if (c === "布头盔") {
                allpoint *= 1.3;
            } else if (c === "皮甲") {
                allpoint *= 1.6;
            } else if (c === "金属铠") {
                allpoint *= 1.6;
            } else if (c === "布甲") {
                allpoint *= 1.6;
            }
*/
            if (xianshi) {
                if (maxpinzhi === "蓝色") {
                    removeandadd(hechengwunamepinzhi, 4);
                    removeandadd(hechengwuname, 4);
                    removeandadd(hechengwunamecitiao, 4);
                } else if (maxpinzhi === "红色") {
                    removeandadd(hechengwunamepinzhi, 5);
                    removeandadd(hechengwuname, 5);
                    removeandadd(hechengwunamecitiao, 5);
                } else if (maxpinzhi === "紫色" || maxpinzhi === "百炼") {
                    removeandadd(hechengwuname, 6);
                    removeandadd(hechengwunamepinzhi, 6);
                    removeandadd(hechengwunamecitiao, 6);
                }

                hechengwunamecitiao.html(t);
                hechengwunamepinzhi.html(finalpinzhi);

                allpoint += apoint;
                hechengwunamepingfen.html('预期评分：' + parseInt(allpoint));
                if (index === 1) {
                    hechengwuname.html(xuetong1leixing2);
                    hechengwunameleixing.html(xuetong1leixing2);
                    hechengwuextra.html(xuetong1extra);
                    hechengwunameshiyong.html('适用职业：' + xuetong1shiyong);
                } else {
                    hechengwuname.html(xuetong2leixing2);
                    hechengwunameleixing.html(xuetong2leixing2);
                    hechengwuextra.html(xuetong2extra);
                    hechengwunameshiyong.html('适用职业：' + xuetong2shiyong);
                }
            }

        } else {
            var o_d, t_d;
            var allinone = [];
            var allpoint = 0;
            allinone = xuetong1.concat(xuetong2);
            allinone = unique(allinone);

            if (xuetong1leixing1 === "防具") {
                o_d = huoquzhidingzhuangbeileixingsuoyoucitiao(xuetong1leixing1, xuetong1leixing2);
            } else {
                o_d = huoquzhidingzhuangbeileixingsuoyoucitiao(xuetong1leixing1, xuetong1leixing2);
            }

            o_d = Object.keys(o_d);

            if (xuetong2leixing1 === "防具") {
                t_d = huoquzhidingzhuangbeileixingsuoyoucitiao(xuetong2leixing1, xuetong2leixing2);
            } else {
                t_d = huoquzhidingzhuangbeileixingsuoyoucitiao(xuetong2leixing1, xuetong2leixing2);
            }

            t_d = Object.keys(t_d);

            var n = 0;
            var t = "";
            if (index === 1) {
                for (var i = 0; i < allinone.length; i++) {
                    if (o_d.indexOf(allinone[i]) !== -1) {
                        n++;
                        t += allinone[i] + "：+???<br/>";
                        ret.push(allinone[i]);
                        var t2 = 0;
                        if (xuetong1leixing1 === "防具") {
                            t2 = (fangjucitiaoshuzhi[allinone[i]][0] + fangjucitiaoshuzhi[allinone[i]][1]) / 2;
                        } else {
                            if (allinone[i].indexOf('技能') !== -1 || allinone[i].indexOf('心法') !== -1) {
                                t2 = 1;
                            } else {
                                t2 = (gongjicitiaoshuzhi[allinone[i]][0] + gongjicitiaoshuzhi[allinone[i]][1]) / 2;
                            }
                        }
                        var tpoint = 0;
                        if (xuetong1leixing1 === "防具") {
                            tpoint = jisuanfangjupingfen(xuetong1leixing1, allinone[i], t2, maxpinzhi);
                        } else {
                            tpoint = jisuanfangjupingfen(xuetong1leixing2, allinone[i], t2, maxpinzhi);
                        }
                        allpoint += tpoint;
                        //console.log(xuetong1name + ' 中可以存在 ' + allinone[i]);
                    } else {
                        // console.log(xuetong1name + ' 中不能存在 ' + allinone[i]);
                    }

                }
            } else {
                for (var i = 0; i < allinone.length; i++) {
                    if (t_d.indexOf(allinone[i]) !== -1) {
                        n++;
                        t += allinone[i] + "：+???<br/>";
                        ret.push(allinone[i]);
                        var t2 = 0;
                        if (xuetong2leixing1 === "防具") {
                            t2 = (fangjucitiaoshuzhi[allinone[i]][0] + fangjucitiaoshuzhi[allinone[i]][1]) / 2;
                        } else {
                            if (allinone[i].indexOf('技能') !== -1 || allinone[i].indexOf('心法') !== -1) {
                                t2 = 1;
                            } else {
                                t2 = (gongjicitiaoshuzhi[allinone[i]][0] + gongjicitiaoshuzhi[allinone[i]][1]) / 2;
                            }
                        }
                        var tpoint = 0;
                        if (xuetong2leixing1 === "防具") {
                            tpoint = jisuanfangjupingfen(xuetong2leixing1, allinone[i], t2, maxpinzhi);
                        } else {
                            tpoint = jisuanfangjupingfen(xuetong2leixing2, allinone[i], t2, maxpinzhi);
                        }
                        allpoint += tpoint;
                        //console.log(xuetong2name + ' 中可以存在 ' + allinone[i]);
                    } else {
                        //console.log(xuetong2name + ' 中不能存在 ' + allinone[i]);
                    }

                }

            }

            if (n < maxpinzhicitiaoshuliang) {
                for (var i = 0; i < maxpinzhicitiaoshuliang - n + 1; i++) {
                    t += "神秘词条：+???<br/>";
                }

            }

            if (n < 4) {
                var t8 = 600;
                if (index === 1) {
                    if (xuetong1leixing2.indexOf('戒指') !== -1) {
                        t8 *= 0.6;
                    } else if (xuetong1leixing2.indexOf('手镯') !== -1) {
                        t8 *= 0.7;
                    } else if (xuetong1leixing2.indexOf('项链') !== -1) {
                        t8 *= 1.3;
                    } else {
                        t8 *= 1.3;
                    }
                } else {
                    if (xuetong2leixing2.indexOf('戒指') !== -1) {
                        t8 *= 0.6;
                    } else if (xuetong2leixing2.indexOf('手镯') !== -1) {
                        t8 *= 0.7;
                    } else if (xuetong2leixing2.indexOf('项链') !== -1) {
                        t8 *= 1.3;
                    } else {
                        t8 *= 1.3;
                    }

                }

                allpoint += t8;
            }
            /*
                        if (c === "腰带") {
                            allpoint *= 1.25;
                        } else if (c === "手套") {
                            allpoint *= 1.8;
                        } else if (c === "鞋子") {
                            allpoint *= 2.1;
                        } else if (c === "皮护腕") {
                            allpoint *= 1.4;
                        } else if (c === "金属护腕") {
                            allpoint *= 1.4;
                        } else if (c === "布护腕") {
                            allpoint *= 1.4;
                        } else if (c === "皮头盔") {
                            allpoint *= 1.3;
                        } else if (c === "金属头盔") {
                            allpoint *= 1.3;
                        } else if (c === "布头盔") {
                            allpoint *= 1.3;
                        } else if (c === "皮甲") {
                            allpoint *= 1.6;
                        } else if (c === "金属铠") {
                            allpoint *= 1.6;
                        } else if (c === "布甲") {
                            allpoint *= 1.6;
                        }
            */
            if (xianshi) {
                if (maxpinzhi === "蓝色") {
                    removeandadd(hechengwunamepinzhi, 4);
                    removeandadd(hechengwuname, 4);
                    removeandadd(hechengwunamecitiao, 4);
                } else if (maxpinzhi === "红色") {
                    removeandadd(hechengwunamepinzhi, 5);
                    removeandadd(hechengwuname, 5);
                    removeandadd(hechengwunamecitiao, 5);
                } else if (maxpinzhi === "紫色" || maxpinzhi === "百炼") {
                    removeandadd(hechengwuname, 6);
                    removeandadd(hechengwunamepinzhi, 6);
                    removeandadd(hechengwunamecitiao, 6);
                }

                hechengwunamecitiao.html(t);
                hechengwunamepinzhi.html(finalpinzhi);
                allpoint += apoint;

                hechengwunamepingfen.html('预期评分：' + parseInt(allpoint));
                if (index === 1) {
                    hechengwuname.html(xuetong1leixing2);
                    hechengwunameleixing.html(xuetong1leixing2);
                    if (xuetong1leixing1.indexOf('武器') !== -1) {
                        if (xuetong1extra.length <= 0) {
                            hechengwuextra.html("攻击速度：0.90-1.08<br/>攻击范围：0.90-1.08<br/>攻击效果：???<br/><br/>");
                        } else {
                            hechengwuextra.html(xuetong1extra);
                        }

                    } else {
                        hechengwuextra.html(xuetong1extra);
                    }
                    hechengwunameshiyong.html('适用职业：' + xuetong1shiyong);
                } else {
                    hechengwuname.html(xuetong2leixing2);
                    hechengwunameleixing.html(xuetong2leixing2);
                    if (xuetong2leixing1.indexOf('武器') !== -1) {
                        if (xuetong2extra.length <= 0) {
                            hechengwuextra.html("攻击速度：0.90-1.08<br/>攻击范围：0.90-1.08<br/>攻击效果：???<br/><br/>");
                        } else {
                            hechengwuextra.html(xuetong2extra);
                        }

                    } else {
                        hechengwuextra.html(xuetong2extra);
                    }
                    hechengwunameshiyong.html('适用职业：' + xuetong2shiyong);
                }
            }

        }

    } else {
        $('#hechengbiaoqian').css('visibility', 'hidden');
        $('#xt1card').removeClass('highpoint');
        $('#xt2card').removeClass('highpoint');
        $('#shengchengwucard').removeClass('highpoint');
        $('#b_view_ct1').css('width', '');
        $('#b_view_ct1').css('visibility', 'visible');
        $('#b_view_ct2').css('visibility', 'visible');

        if (maxpinzhi === "百炼") {
            if (xuetong1pinzhi === "百炼" && xuetong1leixing1.indexOf("武器") !== -1 && (xuetong2leixing2.indexOf("戒指") !== -1 || xuetong2leixing1.indexOf("防具") !== -1)) {
                if (index === 2) {
                    finalpinzhi = finalpinzhi.replace(',百炼', '');
                    maxpinzhi = "紫色";
                }
            }
            if (xuetong2pinzhi === "百炼" && xuetong2leixing1.indexOf("武器") !== -1 && (xuetong1leixing2.indexOf("戒指") !== -1 || xuetong1leixing1.indexOf("防具") !== -1)) {
                if (index === 1) {
                    finalpinzhi = finalpinzhi.replace(',百炼', '');
                    maxpinzhi = "紫色";
                }
            }
        }

        if (maxpinzhi === "蓝色") {
            maxpinzhicitiaoshuliang = 4;
        } else if (maxpinzhi === "红色") {
            maxpinzhicitiaoshuliang = 5;
        } else if (maxpinzhi === "紫色") {
            maxpinzhicitiaoshuliang = 6;
        } else if (maxpinzhi === "百炼") {
            maxpinzhicitiaoshuliang = 7;
        }

        var o_d, t_d;
        var allinone = [];
        var allpoint = 0;
        allinone = xuetong1.concat(xuetong2);
        allinone = unique(allinone);

        if (xuetong1leixing1 === "防具") {
            o_d = huoquzhidingzhuangbeileixingsuoyoucitiao(xuetong1leixing1, xuetong1leixing2);
        } else {
            o_d = huoquzhidingzhuangbeileixingsuoyoucitiao(xuetong1leixing1, xuetong1leixing2);
        }

        o_d = Object.keys(o_d);

        if (xuetong2leixing1 === "防具") {
            t_d = huoquzhidingzhuangbeileixingsuoyoucitiao(xuetong2leixing1, xuetong2leixing2);
        } else {
            t_d = huoquzhidingzhuangbeileixingsuoyoucitiao(xuetong2leixing1, xuetong2leixing2);
        }

        t_d = Object.keys(t_d);

        var n = 0;
        var t = "";
        if (index === 1) {
            for (var i = 0; i < allinone.length; i++) {
                if (o_d.indexOf(allinone[i]) !== -1) {
                    n++;
                    t += allinone[i] + "：+???<br/>";
                    ret.push(allinone[i]);
                    var t2 = 0;
                    if (xuetong1leixing1 === "防具") {
                        t2 = (fangjucitiaoshuzhi[allinone[i]][0] + fangjucitiaoshuzhi[allinone[i]][1]) / 2;
                    } else {
                        if (allinone[i].indexOf('技能') !== -1 || allinone[i].indexOf('心法') !== -1) {
                            t2 = 2;
                        } else {
                            t2 = (gongjicitiaoshuzhi[allinone[i]][0] + gongjicitiaoshuzhi[allinone[i]][1]) / 2;
                        }
                    }
                    var tpoint = 0;
                    if (xuetong1leixing1 === "防具") {
                        tpoint = jisuanfangjupingfen(xuetong1leixing1, allinone[i], t2, maxpinzhi);
                    } else {
                        tpoint = jisuanfangjupingfen(xuetong1leixing2, allinone[i], t2, maxpinzhi);
                    }
                    allpoint += tpoint;
                    //console.log(xuetong1name + ' 中可以存在 ' + allinone[i]);
                } else {
                    // console.log(xuetong1name + ' 中不能存在 ' + allinone[i]);
                }

            }
        } else {
            for (var i = 0; i < allinone.length; i++) {
                if (t_d.indexOf(allinone[i]) !== -1) {
                    n++;
                    t += allinone[i] + "：+???<br/>";
                    ret.push(allinone[i]);
                    var t2 = 0;
                    if (xuetong2leixing1 === "防具") {
                        t2 = (fangjucitiaoshuzhi[allinone[i]][0] + fangjucitiaoshuzhi[allinone[i]][1]) / 2;
                    } else {
                        if (allinone[i].indexOf('技能') !== -1 || allinone[i].indexOf('心法') !== -1) {
                            t2 = 2;
                        } else {
                            t2 = (gongjicitiaoshuzhi[allinone[i]][0] + gongjicitiaoshuzhi[allinone[i]][1]) / 2;
                        }
                    }
                    var tpoint = 0;
                    if (xuetong2leixing1 === "防具") {
                        tpoint = jisuanfangjupingfen(xuetong2leixing1, allinone[i], t2, maxpinzhi);
                    } else {
                        tpoint = jisuanfangjupingfen(xuetong2leixing2, allinone[i], t2, maxpinzhi);
                    }
                    allpoint += tpoint;
                    //console.log(xuetong2name + ' 中可以存在 ' + allinone[i]);
                } else {
                    //console.log(xuetong2name + ' 中不能存在 ' + allinone[i]);
                }

            }

        }

        if (n < 4) {
            var t8 = 600;
            if (index === 1) {
                if (xuetong1leixing2.indexOf('戒指') !== -1) {
                    t8 *= 0.6;
                } else if (xuetong1leixing2.indexOf('手镯') !== -1) {
                    t8 *= 0.7;
                } else if (xuetong1leixing2.indexOf('项链') !== -1) {
                    t8 *= 1.3;
                } else {
                    t8 *= 1.3;
                }
            } else {
                if (xuetong2leixing2.indexOf('戒指') !== -1) {
                    t8 *= 0.6;
                } else if (xuetong2leixing2.indexOf('手镯') !== -1) {
                    t8 *= 0.7;
                } else if (xuetong2leixing2.indexOf('项链') !== -1) {
                    t8 *= 1.3;
                } else {
                    t8 *= 1.3;
                }

            }

            allpoint += t8;
        }
        /*
                if (c === "腰带") {
                    allpoint *= 1.25;
                } else if (c === "手套") {
                    allpoint *= 1.8;
                } else if (c === "鞋子") {
                    allpoint *= 2.1;
                } else if (c === "皮护腕") {
                    allpoint *= 1.4;
                } else if (c === "金属护腕") {
                    allpoint *= 1.4;
                } else if (c === "布护腕") {
                    allpoint *= 1.4;
                } else if (c === "皮头盔") {
                    allpoint *= 1.3;
                } else if (c === "金属头盔") {
                    allpoint *= 1.3;
                } else if (c === "布头盔") {
                    allpoint *= 1.3;
                } else if (c === "皮甲") {
                    allpoint *= 1.6;
                } else if (c === "金属铠") {
                    allpoint *= 1.6;
                } else if (c === "布甲") {
                    allpoint *= 1.6;
                }
        */
        if (n < maxpinzhicitiaoshuliang) {
            for (var i = 0; i < maxpinzhicitiaoshuliang - n; i++) {
                t += "神秘词条：+???<br/>";
            }

        }

        if (xianshi) {
            if (maxpinzhi === "蓝色") {
                removeandadd(hechengwunamepinzhi, 4);
                removeandadd(hechengwuname, 4);
                removeandadd(hechengwunamecitiao, 4);
            } else if (maxpinzhi === "红色") {
                removeandadd(hechengwunamepinzhi, 5);
                removeandadd(hechengwuname, 5);
                removeandadd(hechengwunamecitiao, 5);
            } else if (maxpinzhi === "紫色" || maxpinzhi === "百炼") {
                removeandadd(hechengwuname, 6);
                removeandadd(hechengwunamepinzhi, 6);
                removeandadd(hechengwunamecitiao, 6);
            }

            hechengwunamecitiao.html(t);
            hechengwunamepinzhi.html(finalpinzhi);
            allpoint += apoint;

            hechengwunamepingfen.html('预期评分：' + parseInt(allpoint));
            if (index === 1) {
                hechengwuname.html(xuetong1leixing2);
                hechengwunameleixing.html(xuetong1leixing2);
                if (xuetong1leixing1.indexOf('武器') !== -1) {
                    if (xuetong1extra.length <= 0) {
                        hechengwuextra.html("攻击速度：0.90-1.08<br/>攻击范围：0.90-1.08<br/>攻击效果：???<br/><br/>");
                    } else {
                        hechengwuextra.html(xuetong1extra);
                    }

                } else {
                    hechengwuextra.html(xuetong1extra);
                }

                hechengwunameshiyong.html('适用职业：' + xuetong1shiyong);
            } else {
                hechengwuname.html(xuetong2leixing2);
                hechengwunameleixing.html(xuetong2leixing2);
                if (xuetong2leixing1.indexOf('武器') !== -1) {
                    if (xuetong2extra.length <= 0) {
                        hechengwuextra.html("攻击速度：0.90-1.08<br/>攻击范围：0.90-1.08<br/>攻击效果：???<br/><br/>");
                    } else {
                        hechengwuextra.html(xuetong2extra);
                    }

                } else {
                    hechengwuextra.html(xuetong2extra);
                }
                hechengwunameshiyong.html('适用职业：' + xuetong2shiyong);
            }
        }


    }

    $.each(ret, function (n, v) {
        if (v.indexOf('逆水') !== -1) {
            adds += 0.3;
        }

        if (v.indexOf('凭风') !== -1) {
            adds += 0.15;
        }
    });

    if (xianshi) {
        var t = "";
        if (leixing1 === '防具') {
            var keys = jichushuxing[leixing2];
            $.each(keys, function (n, v) {
                var values = jichushuxingshuzhi[leixing2][v];
                var maxvalue = 0;
                if (pinzhi === '蓝色') {
                    maxvalue = values[0];
                } else if (pinzhi === '红色') {
                    maxvalue = values[1];
                } else if (pinzhi === '紫色') {
                    maxvalue = values[2];
                } else if (pinzhi === '百炼') {
                    maxvalue = values[3];
                }

                maxvalue = maxvalue * adds;
                var displaymaxvalue = "";
                if (maxvalue < 1) {
                    displaymaxvalue = (maxvalue * 100).toFixed(1) + "%";
                    apoint += jisuanfangjupingfen('防具', v, maxvalue * 1000 * 0.75, pinzhi);
                } else {
                    displaymaxvalue = maxvalue.toFixed(0);
                    apoint += jisuanfangjupingfen('防具', v, maxvalue * 0.75, pinzhi);
                }

                t += '<span class="item_jichu">' + v + '：</span>???<span class="item_jichu">(' + displaymaxvalue + ')</span><br/>';


            });


        } else if (leixing1.indexOf('首饰') !== -1) {
            if (leixing2.indexOf('手镯') !== -1 || leixing2.indexOf('项链') !== -1) {
                var keys = jichushuxing[leixing2];
                $.each(keys, function (n, v) {
                    var values = jichushuxingshuzhi[leixing2][v];
                    var maxvalue = 0;
                    if (pinzhi === '蓝色') {
                        maxvalue = values[0];
                    } else if (pinzhi === '红色') {
                        maxvalue = values[1];
                    } else if (pinzhi === '紫色') {
                        maxvalue = values[2];
                    } else if (pinzhi === '百炼') {
                        maxvalue = values[3];
                    }

                    maxvalue = maxvalue * adds;
                    var displaymaxvalue = "";


                    displaymaxvalue = maxvalue.toFixed(0);
                    apoint += jisuanfangjupingfen(leixing2, v, maxvalue * 0.75, pinzhi);

                    t += '<span class="item_jichu">' + v + '：</span>???<span class="item_jichu">(' + displaymaxvalue + ')</span><br/>';


                });


            } else if (leixing2.indexOf('戒指') !== -1) {
                var keys = jichushuxing[leixing2];
                $.each(keys, function (n, v) {
                    var values = jichushuxingshuzhi[leixing2][v];
                    var maxvalue = [0, 0];
                    if (pinzhi === '蓝色') {
                        maxvalue = values[0];
                    } else if (pinzhi === '红色') {
                        maxvalue = values[1];
                    } else if (pinzhi === '紫色') {
                        maxvalue = values[2];
                    } else if (pinzhi === '百炼') {
                        maxvalue = values[3];
                    }

                    var tmax1 = maxvalue[0] * adds;
                    var tmax2 = maxvalue[1] * adds;

                    apoint += jisuanfangjupingfen(leixing2, v, tmax2 * 0.75, pinzhi);
                    t += '<span class="item_jichu">' + v + '：</span>??? - ???<span class="item_jichu">(' + tmax1.toFixed(0) + ' - ' + tmax2.toFixed(0) + ')</span><br/>';


                });

            }

        } else {
            var keys = jichushuxing['武器'];
            if (pinzhi === '百炼') {
                $.each(keys, function (n, v) {
                    apoint += jisuanfangjupingfen(leixing2, v, 640 * 0.75, pinzhi);
                    t += '<span class="item_jichu">' + v + '：</span>??? - ???<span class="item_jichu">(209 - 640)</span><br/>';
                });

            } else if (pinzhi === '紫色') {
                $.each(keys, function (n, v) {
                    apoint += jisuanfangjupingfen(leixing2, v, 544 * 0.75, pinzhi);
                    t += '<span class="item_jichu">' + v + '：</span>??? - ???<span class="item_jichu">(186 - 544)</span><br/>';
                });
            } else {
                var keys = jichushuxing['武器'];
                $.each(keys, function (n, v) {
                    var values = jichushuxingshuzhi['武器'][v];
                    var maxvalue = [0, 0];
                    if (pinzhi === '蓝色') {
                        maxvalue = values[0];
                    } else if (pinzhi === '红色') {
                        maxvalue = values[1];
                    }

                    var tmax1 = maxvalue[0] * adds;
                    var tmax2 = maxvalue[1] * adds;
                    apoint += jisuanfangjupingfen(leixing2, v, tmax2 * 0.75, pinzhi);
                    t += '<span class="item_jichu">' + v + '：</span>??? - ???<span class="item_jichu">(' + tmax1.toFixed(0) + ' - ' + tmax2.toFixed(0) + ')</span><br/>';


                });

            }

        }

        t += '<br/>';
        hechengwujichu_.html(t);

    }
    return ret;

}

function removeandadd(id, level) {
    id.removeClass(function (index, currentclass) {
        if (currentclass.indexOf('item_pinzhif') !== -1) {
            return currentclass;
        }
    });
    id.addClass('item_pinzhif_' + level);
}

function xuetong1chuli() {
    if (xuetong1.length <= 0) {
        return;
    }
    var xuetong1name_ = $('#xuetong1name');
    var xuetong1shiyong_ = $('#xuetong1shiyong');
    var xuetong1leixing = $('#xuetong1leixing');
    var xuetong1pinzhi_ = $('#xuetong1pinzhi');
    var xuetong1citiao_ = $('#xuetong1citiao');
    var xuetong1extra_ = $('#xuetong1extra');
    var xuetong1jichu_ = $('#xuetong1jichu');

    if (xuetong1pinzhi === "紫色" || xuetong1pinzhi === "百炼") {
        removeandadd(xuetong1name_, 6);
        removeandadd(xuetong1citiao_, 6);
        removeandadd(xuetong1pinzhi_, 6);
    } else if (xuetong1pinzhi === "红色") {
        removeandadd(xuetong1name_, 5);
        removeandadd(xuetong1citiao_, 5);
        removeandadd(xuetong1pinzhi_, 5);
    } else {
        removeandadd(xuetong1name_, 4);
        removeandadd(xuetong1citiao_, 4);
        removeandadd(xuetong1pinzhi_, 4);
    }

    xuetong1pinzhi_.html(xuetong1pinzhi);
    xuetong1jichu_.html(xuetong1jichu);

    xuetong1name_.html(xuetong1name);
    xuetong1extra_.html(xuetong1extra);
    xuetong1shiyong_.html("适用职业：" + xuetong1shiyong);
    xuetong1leixing.html(xuetong1leixing2);
    xuetong1citiao_.html(xuetong1citiao);
    $('#xuetong1pingfen').html(parseInt(xuetong1pingfen));

}

function xuetong2chuli() {
    if (xuetong2.length <= 0) {
        return;
    }
    var xuetong2name_ = $('#xuetong2name');
    var xuetong2shiyong_ = $('#xuetong2shiyong');
    var xuetong2leixing = $('#xuetong2leixing');
    var xuetong2pinzhi_ = $('#xuetong2pinzhi');
    var xuetong2citiao_ = $('#xuetong2citiao');
    var xuetong2extra_ = $('#xuetong2extra');
    var xuetong2jichu_ = $('#xuetong2jichu');

    if (xuetong2pinzhi === "紫色" || xuetong2pinzhi === "百炼") {
        removeandadd(xuetong2name_, 6);
        removeandadd(xuetong2citiao_, 6);
        removeandadd(xuetong2pinzhi_, 6);
    } else if (xuetong2pinzhi === "红色") {
        removeandadd(xuetong2name_, 5);
        removeandadd(xuetong2citiao_, 5);
        removeandadd(xuetong2pinzhi_, 5);
    } else {
        removeandadd(xuetong2name_, 4);
        removeandadd(xuetong2citiao_, 4);
        removeandadd(xuetong2pinzhi_, 4);
    }

    xuetong2pinzhi_.html(xuetong2pinzhi);
    xuetong2jichu_.html(xuetong2jichu);
    xuetong2name_.html(xuetong2name);
    xuetong2extra_.html(xuetong2extra);
    xuetong2shiyong_.html("适用职业：" + xuetong2shiyong);
    xuetong2leixing.html(xuetong2leixing2);
    xuetong2citiao_.html(xuetong2citiao);
    $('#xuetong2pingfen').html(parseInt(xuetong2pingfen));
}